1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.rice.kew.api.document; |
17 | |
|
18 | |
import java.util.Collection; |
19 | |
|
20 | |
import javax.xml.bind.annotation.XmlAccessType; |
21 | |
import javax.xml.bind.annotation.XmlAccessorType; |
22 | |
import javax.xml.bind.annotation.XmlAnyElement; |
23 | |
import javax.xml.bind.annotation.XmlElement; |
24 | |
import javax.xml.bind.annotation.XmlRootElement; |
25 | |
import javax.xml.bind.annotation.XmlType; |
26 | |
|
27 | |
import org.apache.commons.lang.StringUtils; |
28 | |
import org.kuali.rice.core.api.CoreConstants; |
29 | |
import org.w3c.dom.Element; |
30 | |
|
31 | |
@XmlRootElement(name = PropertyDefinition.Constants.ROOT_ELEMENT_NAME) |
32 | |
@XmlAccessorType(XmlAccessType.NONE) |
33 | |
@XmlType(name = PropertyDefinition.Constants.TYPE_NAME, propOrder = { |
34 | |
PropertyDefinition.Elements.NAME, |
35 | |
PropertyDefinition.Elements.VALUE, |
36 | |
CoreConstants.CommonElements.FUTURE_ELEMENTS |
37 | |
}) |
38 | |
public final class PropertyDefinition { |
39 | |
|
40 | |
@XmlElement(name = Elements.NAME, required = true) |
41 | |
private final String name; |
42 | |
|
43 | |
@XmlElement(name = Elements.VALUE, required = false) |
44 | |
private final String value; |
45 | |
|
46 | 0 | @SuppressWarnings("unused") |
47 | |
@XmlAnyElement |
48 | |
private final Collection<Element> _futureElements = null; |
49 | |
|
50 | |
@SuppressWarnings("unused") |
51 | 0 | private PropertyDefinition() { |
52 | 0 | this.name = null; |
53 | 0 | this.value = null; |
54 | 0 | } |
55 | |
|
56 | |
public static PropertyDefinition create(String name, String value) { |
57 | 0 | return new PropertyDefinition(name, value); |
58 | |
} |
59 | |
|
60 | 0 | private PropertyDefinition(String name, String value) { |
61 | 0 | if (StringUtils.isBlank(name)) { |
62 | 0 | throw new IllegalArgumentException("name is null or blank"); |
63 | |
} |
64 | 0 | this.name = name; |
65 | 0 | this.value = value; |
66 | 0 | } |
67 | |
|
68 | |
public String getName() { |
69 | 0 | return name; |
70 | |
} |
71 | |
|
72 | |
public String getValue() { |
73 | 0 | return value; |
74 | |
} |
75 | |
|
76 | |
|
77 | |
|
78 | |
|
79 | 0 | static class Constants { |
80 | |
final static String ROOT_ELEMENT_NAME = "propertyDefinition"; |
81 | |
final static String TYPE_NAME = "PropertyDefinitionType"; |
82 | 0 | final static String[] HASH_CODE_EQUALS_EXCLUDE = new String[]{CoreConstants.CommonElements.FUTURE_ELEMENTS}; |
83 | |
} |
84 | |
|
85 | |
|
86 | |
|
87 | |
|
88 | |
|
89 | 0 | static class Elements { |
90 | |
final static String NAME = "name"; |
91 | |
final static String VALUE = "value"; |
92 | |
} |
93 | |
|
94 | |
} |