Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
DocumentAttributeString |
|
| 1.0;1 | ||||
DocumentAttributeString$1 |
|
| 1.0;1 | ||||
DocumentAttributeString$Builder |
|
| 1.0;1 | ||||
DocumentAttributeString$Constants |
|
| 1.0;1 | ||||
DocumentAttributeString$Elements |
|
| 1.0;1 |
1 | /** | |
2 | * Copyright 2005-2011 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.kew.api.document.attribute; | |
17 | ||
18 | import javax.xml.bind.annotation.XmlAccessType; | |
19 | import javax.xml.bind.annotation.XmlAccessorType; | |
20 | import javax.xml.bind.annotation.XmlElement; | |
21 | import javax.xml.bind.annotation.XmlRootElement; | |
22 | import javax.xml.bind.annotation.XmlType; | |
23 | ||
24 | /** | |
25 | * A document attribute which contains character data. Construct instances of {@code DocumentAttributeString} using | |
26 | * it's builder or the {@link DocumentAttributeFactory}. | |
27 | * | |
28 | * @author Kuali Rice Team (rice.collab@kuali.org) | |
29 | */ | |
30 | 0 | @XmlRootElement(name = DocumentAttributeString.Constants.ROOT_ELEMENT_NAME) |
31 | @XmlAccessorType(XmlAccessType.NONE) | |
32 | @XmlType(name = DocumentAttributeString.Constants.TYPE_NAME, propOrder = { | |
33 | DocumentAttributeString.Elements.VALUE | |
34 | }) | |
35 | 0 | public final class DocumentAttributeString extends DocumentAttribute { |
36 | ||
37 | @XmlElement(name = Elements.VALUE, required = false) | |
38 | private final String value; | |
39 | ||
40 | @SuppressWarnings("unused") | |
41 | 0 | private DocumentAttributeString() { |
42 | 0 | this.value = null; |
43 | 0 | } |
44 | ||
45 | private DocumentAttributeString(Builder builder) { | |
46 | 0 | super(builder.getName()); |
47 | 0 | this.value = builder.getValue(); |
48 | 0 | } |
49 | ||
50 | @Override | |
51 | public String getValue() { | |
52 | 0 | return value; |
53 | } | |
54 | ||
55 | @Override | |
56 | public DocumentAttributeDataType getDataType() { | |
57 | 0 | return DocumentAttributeDataType.STRING; |
58 | } | |
59 | ||
60 | /** | |
61 | * A builder implementation which allows for construction of a {@code DocumentAttributeString}. | |
62 | */ | |
63 | 0 | public static final class Builder extends AbstractBuilder<String> { |
64 | ||
65 | private Builder(String name) { | |
66 | 0 | super(name); |
67 | 0 | } |
68 | ||
69 | /** | |
70 | * Create a builder for the document attribute using the given attribute name. | |
71 | * | |
72 | * @param name the name of the document attribute which should be built by this builder, should never be a | |
73 | * null or blank value | |
74 | * @return a builder instance initialized with the given attribute name | |
75 | */ | |
76 | public static Builder create(String name) { | |
77 | 0 | return new Builder(name); |
78 | } | |
79 | ||
80 | @Override | |
81 | public DocumentAttributeDataType getDataType() { | |
82 | 0 | return DocumentAttributeDataType.STRING; |
83 | } | |
84 | ||
85 | @Override | |
86 | public DocumentAttributeString build() { | |
87 | 0 | return new DocumentAttributeString(this); |
88 | } | |
89 | ||
90 | } | |
91 | ||
92 | /** | |
93 | * Defines some internal constants used on this class. | |
94 | */ | |
95 | 0 | static class Constants { |
96 | final static String ROOT_ELEMENT_NAME = "documentAttributeString"; | |
97 | final static String TYPE_NAME = "DocumentAttributeStringType"; | |
98 | } | |
99 | ||
100 | /** | |
101 | * A private class which exposes constants which define the XML element names to use when this object is marshalled to XML. | |
102 | */ | |
103 | 0 | static class Elements { |
104 | final static String VALUE = "value"; | |
105 | } | |
106 | ||
107 | } |