public class DateTimeAttribute extends AttributeValue
Date
objects returned are not, but
these objects are cloned before being returned.Modifier and Type | Field and Description |
---|---|
static String |
identifier
Official name of this type
|
static int |
TZ_UNSPECIFIED
Time zone value that indicates that the time zone was not
specified.
|
Constructor and Description |
---|
DateTimeAttribute()
Creates a new
DateTimeAttribute that represents
the current date in the default time zone. |
DateTimeAttribute(Date dateTime)
Creates a new
DateTimeAttribute that represents
the supplied date but uses default timezone and offset values. |
DateTimeAttribute(Date dateTime,
int nanoseconds,
int timeZone,
int defaultedTimeZone)
Creates a new
DateTimeAttribute that represents
the date supplied. |
Modifier and Type | Method and Description |
---|---|
String |
encode()
Encodes the value in a form suitable for including in XML data like
a request or an obligation.
|
boolean |
equals(Object o)
Returns true if the input is an instance of this class and if its
value equals the value contained in this class.
|
int |
getDefaultedTimeZone()
Gets the time zone actually used for this object (if it was
originally unspecified, the default time zone used).
|
static DateTimeAttribute |
getInstance(Node root)
Returns a new
DateTimeAttribute that represents
the xs:dateTime at a particular DOM node. |
static DateTimeAttribute |
getInstance(String value)
Returns a new
DateTimeAttribute that represents
the xs:dateTime value indicated by the string provided. |
int |
getNanoseconds()
Gets the nanoseconds of this object.
|
int |
getTimeZone()
Gets the time zone of this object (or TZ_UNSPECIFIED if
unspecified).
|
Date |
getValue()
Gets the date and time represented by this object.
|
int |
hashCode()
Returns the hashcode value used to index and compare this object with
others of the same type.
|
String |
toString()
Converts to a String representation.
|
encode, encode, encodeWithTags, evaluate, evaluatesToBag, getChildren, getType, isBag, returnsBag
public static final String identifier
public static final int TZ_UNSPECIFIED
public DateTimeAttribute()
DateTimeAttribute
that represents
the current date in the default time zone.public DateTimeAttribute(Date dateTime)
DateTimeAttribute
that represents
the supplied date but uses default timezone and offset values.dateTime
- a Date
object representing the
specified date and time down to second
resolution. If this object has non-zero
milliseconds, they are combined
with the nanoseconds parameter.public DateTimeAttribute(Date dateTime, int nanoseconds, int timeZone, int defaultedTimeZone)
DateTimeAttribute
that represents
the date supplied.dateTime
- a Date
object representing the
specified date and time down to second
resolution. If this object has non-zero
milliseconds, they are combined
with the nanoseconds parameter.nanoseconds
- the number of nanoseconds beyond the
Date specified in the date parametertimeZone
- the time zone specified for this object
(or TZ_UNSPECIFIED if unspecified). The
offset to GMT, in minutes.defaultedTimeZone
- the time zone actually used for this
object (if it was originally unspecified,
the default time zone used).
The offset to GMT, in minutes.public static DateTimeAttribute getInstance(Node root) throws ParsingException, NumberFormatException, ParseException
DateTimeAttribute
that represents
the xs:dateTime at a particular DOM node.root
- the Node
that contains the desired valueDateTimeAttribute
representing the
appropriate valueParsingException
- if any problems occurred while parsingNumberFormatException
ParseException
public static DateTimeAttribute getInstance(String value) throws ParsingException, NumberFormatException, ParseException
DateTimeAttribute
that represents
the xs:dateTime value indicated by the string provided.value
- a string representing the desired valueDateTimeAttribute
representing the
desired valueParsingException
- if the text is formatted incorrectlyNumberFormatException
- if the nanosecond format is incorrectParseException
public Date getValue()
Date
object representing the
specified date and time down to second resolution.
Subsecond values are handled by the
getNanoseconds
method.
NOTE: The Date
object is cloned before it
is returned to avoid unauthorized changes.
getValue
in class AttributeValue
Date
object representing the date and
time represented by this objectpublic int getNanoseconds()
public int getTimeZone()
public int getDefaultedTimeZone()
public boolean equals(Object o)
Two DateTimeAttribute
s are equal if and only if the
dates and times represented are identical (down to the nanosecond).
public int hashCode()
public String toString()
public String encode()
encode
in class AttributeValue
String
form of the valueCopyright © 2023 JBoss by Red Hat. All rights reserved.