1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.opensaml.xml.schema.impl;
18
19 import java.util.Collections;
20 import java.util.List;
21
22 import org.joda.time.DateTime;
23 import org.joda.time.chrono.ISOChronology;
24 import org.joda.time.format.DateTimeFormatter;
25 import org.joda.time.format.ISODateTimeFormat;
26 import org.opensaml.xml.XMLObject;
27 import org.opensaml.xml.schema.XSDateTime;
28 import org.opensaml.xml.validation.AbstractValidatingXMLObject;
29
30
31
32
33
34 public class XSDateTimeImpl extends AbstractValidatingXMLObject implements XSDateTime {
35
36
37 private DateTime value;
38
39
40 private DateTimeFormatter formatter;
41
42
43
44
45
46
47
48
49 protected XSDateTimeImpl(String namespaceURI, String elementLocalName, String namespacePrefix) {
50 super(namespaceURI, elementLocalName, namespacePrefix);
51 formatter = ISODateTimeFormat.dateTime().withChronology(ISOChronology.getInstanceUTC());
52 }
53
54
55 public DateTime getValue() {
56 return value;
57 }
58
59
60 public void setValue(DateTime newValue) {
61 value = prepareForAssignment(value, newValue);
62 }
63
64
65 public List<XMLObject> getOrderedChildren() {
66 return Collections.emptyList();
67 }
68
69
70 public DateTimeFormatter getDateTimeFormatter() {
71 return formatter;
72 }
73
74
75 public void setDateTimeFormatter(DateTimeFormatter newFormatter) {
76 if (newFormatter == null) {
77 throw new IllegalArgumentException("The specified DateTimeFormatter may not be null");
78 }
79 formatter = newFormatter;
80 }
81
82 }