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.kuali.rice.core.api.mo.AbstractDataTransferObject;
30 import org.w3c.dom.Element;
31
32 @XmlRootElement(name = PropertyDefinition.Constants.ROOT_ELEMENT_NAME)
33 @XmlAccessorType(XmlAccessType.NONE)
34 @XmlType(name = PropertyDefinition.Constants.TYPE_NAME, propOrder = {
35 PropertyDefinition.Elements.NAME,
36 PropertyDefinition.Elements.VALUE,
37 CoreConstants.CommonElements.FUTURE_ELEMENTS
38 })
39 public final class PropertyDefinition extends AbstractDataTransferObject {
40
41 @XmlElement(name = Elements.NAME, required = true)
42 private final String name;
43
44 @XmlElement(name = Elements.VALUE, required = false)
45 private final String value;
46
47 @SuppressWarnings("unused")
48 @XmlAnyElement
49 private final Collection<Element> _futureElements = null;
50
51 @SuppressWarnings("unused")
52 private PropertyDefinition() {
53 this.name = null;
54 this.value = null;
55 }
56
57 public static PropertyDefinition create(String name, String value) {
58 return new PropertyDefinition(name, value);
59 }
60
61 private PropertyDefinition(String name, String value) {
62 if (StringUtils.isBlank(name)) {
63 throw new IllegalArgumentException("name is null or blank");
64 }
65 this.name = name;
66 this.value = value;
67 }
68
69 public String getName() {
70 return name;
71 }
72
73 public String getValue() {
74 return value;
75 }
76
77
78
79
80 static class Constants {
81 final static String ROOT_ELEMENT_NAME = "propertyDefinition";
82 final static String TYPE_NAME = "PropertyDefinitionType";
83 }
84
85
86
87
88
89 static class Elements {
90 final static String NAME = "name";
91 final static String VALUE = "value";
92 }
93
94 }