| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| ExportMap |
|
| 2.0;2 |
| 1 | /* | |
| 2 | * Copyright 2005-2007 The Kuali Foundation | |
| 3 | * | |
| 4 | * Licensed under the Educational Community License, Version 2.0 (the "License"); | |
| 5 | * you may not use this file except in compliance with the License. | |
| 6 | * You may obtain a copy of the License at | |
| 7 | * | |
| 8 | * http://www.opensource.org/licenses/ecl2.php | |
| 9 | * | |
| 10 | * Unless required by applicable law or agreed to in writing, software | |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, | |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 13 | * See the License for the specific language governing permissions and | |
| 14 | * limitations under the License. | |
| 15 | */ | |
| 16 | package org.kuali.rice.krad.datadictionary.exporter; | |
| 17 | ||
| 18 | import java.util.Collections; | |
| 19 | import java.util.Map; | |
| 20 | ||
| 21 | /* | |
| 22 | * An ExportMap represents an entry or definition from the dataDictionary as a Map of the contents of that entry or definintion, and | |
| 23 | * the key by which that entry or definition will be stored in the parent Map. | |
| 24 | * | |
| 25 | * | |
| 26 | */ | |
| 27 | @Deprecated | |
| 28 | public class ExportMap { | |
| 29 | private final String exportKey; | |
| 30 | private final StringMap exportData; | |
| 31 | ||
| 32 | 0 | public ExportMap(String exportKey) { |
| 33 | 0 | this.exportKey = exportKey; |
| 34 | 0 | this.exportData = new StringMap(); |
| 35 | 0 | } |
| 36 | ||
| 37 | ||
| 38 | /** | |
| 39 | * @return exportKey associated with this instance | |
| 40 | */ | |
| 41 | public String getExportKey() { | |
| 42 | 0 | return this.exportKey; |
| 43 | } | |
| 44 | ||
| 45 | /** | |
| 46 | * @return unmodifiable copy of the exportData associated with this Map | |
| 47 | */ | |
| 48 | public Map getExportData() { | |
| 49 | 0 | return Collections.unmodifiableMap(this.exportData); |
| 50 | } | |
| 51 | ||
| 52 | ||
| 53 | /** | |
| 54 | * Adds the ExportMap's exportKey and exportData as a key,value pair to this Map | |
| 55 | * | |
| 56 | * @param key | |
| 57 | * @param value | |
| 58 | */ | |
| 59 | public void set(ExportMap map) { | |
| 60 | 0 | if (map == null) { |
| 61 | 0 | throw new IllegalArgumentException("invalid (null) map"); |
| 62 | } | |
| 63 | ||
| 64 | 0 | exportData.set(map.getExportKey(), map.getExportData()); |
| 65 | 0 | } |
| 66 | ||
| 67 | /** | |
| 68 | * If the given map is not null, adds the ExportMap's exportKey and exportData as a key,value pair to this Map | |
| 69 | * | |
| 70 | * @param key | |
| 71 | * @param value | |
| 72 | */ | |
| 73 | public void setOptional(ExportMap map) { | |
| 74 | 0 | if (map != null) { |
| 75 | 0 | set(map); |
| 76 | } | |
| 77 | 0 | } |
| 78 | ||
| 79 | /** | |
| 80 | * Adds the given key,value pair to this Map | |
| 81 | * | |
| 82 | * @param key | |
| 83 | * @param value | |
| 84 | */ | |
| 85 | public void set(String key, String value) { | |
| 86 | 0 | if (key == null) { |
| 87 | 0 | throw new IllegalArgumentException("invalid (null) key"); |
| 88 | } | |
| 89 | 0 | if (value == null) { |
| 90 | 0 | throw new IllegalArgumentException("invalid (null) value - key=" + key); |
| 91 | } | |
| 92 | ||
| 93 | 0 | exportData.set(key, value); |
| 94 | 0 | } |
| 95 | ||
| 96 | ||
| 97 | /** | |
| 98 | * @see java.lang.Object#toString() | |
| 99 | */ | |
| 100 | public String toString() { | |
| 101 | 0 | return this.exportKey + "(" + this.exportData.size() + " children)"; |
| 102 | } | |
| 103 | } |