Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
StringMapEntry |
|
| 1.0;1 |
1 | /* | |
2 | * Copyright 2007-2010 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.core.util.jaxb; | |
17 | ||
18 | import java.io.Serializable; | |
19 | import java.util.Map; | |
20 | ||
21 | import javax.xml.bind.annotation.XmlAccessType; | |
22 | import javax.xml.bind.annotation.XmlAccessorType; | |
23 | import javax.xml.bind.annotation.XmlAttribute; | |
24 | import javax.xml.bind.annotation.XmlType; | |
25 | import javax.xml.bind.annotation.XmlValue; | |
26 | ||
27 | /** | |
28 | * Single String-String key-value pair for | |
29 | * marshalling/unmarshalling. Need this rather than | |
30 | * general Map.Entry<String, String> to specify | |
31 | * cardinality in resulting wsdl's. | |
32 | * | |
33 | * @author Kuali Rice Team (rice.collab@kuali.org) | |
34 | * | |
35 | */ | |
36 | @XmlAccessorType(XmlAccessType.NONE) | |
37 | @XmlType(name = "StringMapEntryType") | |
38 | public final class StringMapEntry implements Serializable { | |
39 | ||
40 | private static final long serialVersionUID = -9609663434312103L; | |
41 | ||
42 | @XmlAttribute (name = "key") | |
43 | private final String key; | |
44 | ||
45 | @XmlValue | |
46 | private final String value; | |
47 | ||
48 | /** | |
49 | * Used only by JAXB. | |
50 | */ | |
51 | @SuppressWarnings("unused") | |
52 | 2 | private StringMapEntry() { |
53 | 2 | this.key = null; |
54 | 2 | this.value = null; |
55 | 2 | } |
56 | ||
57 | 0 | public StringMapEntry(String key, String value) { |
58 | 0 | this.key = key; |
59 | 0 | this.value = value; |
60 | 0 | } |
61 | ||
62 | 1 | public StringMapEntry(Map.Entry<String, String> e) { |
63 | 1 | this.key = e.getKey(); |
64 | 1 | this.value = e.getValue(); |
65 | 1 | } |
66 | ||
67 | public String getKey() { | |
68 | 2 | return this.key; |
69 | } | |
70 | ||
71 | public String getValue() { | |
72 | 2 | return this.value; |
73 | } | |
74 | ||
75 | } |