View Javadoc

1   package org.kuali.rice.kew.api.document.attribute;
2   
3   /**
4    * TODO...
5    */
6   
7   import org.joda.time.DateTime;
8   
9   import javax.xml.bind.annotation.XmlAccessType;
10  import javax.xml.bind.annotation.XmlAccessorType;
11  import javax.xml.bind.annotation.XmlElement;
12  import javax.xml.bind.annotation.XmlRootElement;
13  import javax.xml.bind.annotation.XmlType;
14  
15  @XmlRootElement(name = DocumentAttributeDateTime.Constants.ROOT_ELEMENT_NAME)
16  @XmlAccessorType(XmlAccessType.NONE)
17  @XmlType(name = DocumentAttributeDateTime.Constants.TYPE_NAME, propOrder = {
18      DocumentAttributeDateTime.Elements.VALUE
19  })
20  public final class DocumentAttributeDateTime extends DocumentAttribute<DateTime> {
21  
22      @XmlElement(name = Elements.VALUE, required = false)
23      private final DateTime value;
24  
25      /**
26       * Private constructor used only by JAXB.
27       */
28      private DocumentAttributeDateTime() {
29          this.value = null;
30      }
31  
32      public DocumentAttributeDateTime(String name, DateTime value) {
33          super(name);
34          this.value = value;
35      }
36  
37      public static DocumentAttributeDateTime create(String name, DateTime value) {
38          return new DocumentAttributeDateTime(name, value);
39      }
40  
41      @Override
42      public DateTime getValue() {
43          return value;
44      }
45  
46      @Override
47      public DocumentAttributeDataType getDataType() {
48          return DocumentAttributeDataType.DATE_TIME;
49      }
50  
51      /**
52       * Defines some internal constants used on this class.
53       */
54      static class Constants {
55          final static String ROOT_ELEMENT_NAME = "documentAttributeDateTime";
56          final static String TYPE_NAME = "DocumentAttributeDateTimeType";
57      }
58  
59      /**
60       * A private class which exposes constants which define the XML element names to use when this object is marshalled to XML.
61       */
62      static class Elements {
63          final static String VALUE = "value";
64      }
65  
66  }