View Javadoc

1   package org.kuali.rice.kew.api.document.attribute;
2   
3   import javax.xml.bind.annotation.XmlAccessType;
4   import javax.xml.bind.annotation.XmlAccessorType;
5   import javax.xml.bind.annotation.XmlElement;
6   import javax.xml.bind.annotation.XmlRootElement;
7   import javax.xml.bind.annotation.XmlType;
8   import java.math.BigInteger;
9   
10  /**
11   * A document attribute which contains integer data.  Construct instances of {@code DocumentAttributeInteger} using
12   * it's builder or the {@link DocumentAttributeFactory}.
13   *
14   * @author Kuali Rice Team (rice.collab@kuali.org)
15   */
16  @XmlRootElement(name = DocumentAttributeInteger.Constants.ROOT_ELEMENT_NAME)
17  @XmlAccessorType(XmlAccessType.NONE)
18  @XmlType(name = DocumentAttributeInteger.Constants.TYPE_NAME, propOrder = {
19      DocumentAttributeInteger.Elements.VALUE
20  })
21  public final class DocumentAttributeInteger extends DocumentAttribute {
22  
23      @XmlElement(name = Elements.VALUE, required = false)
24      private final BigInteger value;
25  
26      @SuppressWarnings("unused")
27      private DocumentAttributeInteger() {
28          this.value = null;
29      }
30  
31      private DocumentAttributeInteger(Builder builder) {
32          super(builder.getName());
33          this.value = builder.getValue();
34      }
35  
36      @Override
37      public BigInteger getValue() {
38          return value;
39      }
40  
41      @Override
42      public DocumentAttributeDataType getDataType() {
43          return DocumentAttributeDataType.INTEGER;
44      }
45  
46      public static final class Builder extends AbstractBuilder<BigInteger> {
47  
48          private Builder(String name) {
49              super(name);
50          }
51  
52          public static Builder create(String name) {
53              return new Builder(name);
54          }
55  
56          @Override
57          public DocumentAttributeDataType getDataType() {
58              return DocumentAttributeDataType.INTEGER;
59          }
60  
61          @Override
62          public DocumentAttributeInteger build() {
63              return new DocumentAttributeInteger(this);
64          }
65  
66      }
67  
68      /**
69       * Defines some internal constants used on this class.
70       */
71      static class Constants {
72          final static String ROOT_ELEMENT_NAME = "documentAttributeInteger";
73          final static String TYPE_NAME = "DocumentAttributeIntegerType";
74      }
75  
76      /**
77       * A private class which exposes constants which define the XML element names to use when this object is marshalled to XML.
78       */
79      static class Elements {
80          final static String VALUE = "value";
81      }
82  
83  }