public final class AtomDate
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable
Provides an implementation of the Atom Date Construct, which is itself a specialization of the RFC3339 date-time.
Accessors on this class are not synchronized.
Per RFC4287:
3.3. Date Constructs A Date construct is an element whose content MUST conform to the "date-time" production in [RFC3339]. In addition, an uppercase "T" character MUST be used to separate date and time, and an uppercase "Z" character MUST be present in the absence of a numeric time zone offset. atomDateConstruct = atomCommonAttributes, xsd:dateTime Such date values happen to be compatible with the following specifications: [ISO.8601.1988], [W3C.NOTE-datetime-19980827], and [W3C.REC-xmlschema-2-20041028]. Example Date constructs: <updated>2003-12-13T18:30:02Z</updated> <updated>2003-12-13T18:30:02.25Z</updated> <updated>2003-12-13T18:30:02+01:00</updated> <updated>2003-12-13T18:30:02.25+01:00</updated> Date values SHOULD be as accurate as possible. For example, it would be generally inappropriate for a publishing system to apply the same timestamp to several entries that were published during the course of a single day.
Constructor and Description |
---|
AtomDate()
Create an AtomDate using the current date and time
|
AtomDate(java.util.Calendar value)
Create an AtomDate using a java.util.Calendar.
|
AtomDate(java.util.Date value)
Create an AtomDate using a java.util.Date
|
AtomDate(long value)
Create an AtomDate using the number of milliseconds since January 1, 1970, 00:00:00 GMT
|
AtomDate(java.lang.String value)
Create an AtomDate using the serialized string format (e.g.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
clone() |
boolean |
equals(java.lang.Object obj) |
static java.lang.String |
format(java.util.Date date)
Create the serialized string form from a java.util.Date
|
java.util.Calendar |
getCalendar()
Returns the value of this Atom Date as a java.util.Calendar
|
java.util.Date |
getDate()
Returns the value of this Atom Date
|
long |
getTime()
Returns the value of this Atom Date as the number of milliseconds since January 1, 1970, 00:00:00 GMT
|
java.lang.String |
getValue()
Return the serialized string form of the Atom date
|
int |
hashCode() |
static java.util.Date |
parse(java.lang.String date)
Parse the serialized string form into a java.util.Date
|
AtomDate |
setValue(java.util.Calendar calendar)
Sets the value of the Atom date using java.util.Calendar
|
AtomDate |
setValue(java.util.Date date)
Sets the value of the Atom date using java.util.Date
|
AtomDate |
setValue(long timestamp)
Sets the value of the Atom date using the number of milliseconds since January 1, 1970, 00:00:00 GMT
|
AtomDate |
setValue(java.lang.String value)
Sets the value of the Atom date using the serialized string form
|
java.lang.String |
toString() |
static AtomDate |
valueOf(java.util.Calendar value)
Create a new Atom Date instance from a java.util.Calendar
|
static AtomDate |
valueOf(java.util.Date value)
Create a new Atom Date instance from a java.util.Date
|
static AtomDate |
valueOf(long value)
Create a new Atom Date instance using the number of milliseconds since January 1, 1970, 00:00:00 GMT
|
static AtomDate |
valueOf(java.lang.String value)
Create a new Atom Date instance from the serialized string form
|
public AtomDate()
public AtomDate(java.lang.String value)
value
- The serialized RFC3339 date/time valuepublic AtomDate(java.util.Date value)
value
- The java.util.Date valuejava.lang.NullPointerException
- if date
is null
public AtomDate(java.util.Calendar value)
value
- The java.util.Calendar valuejava.lang.NullPointerException
- if value
is null
public AtomDate(long value)
value
- The number of milliseconds since January 1, 1970, 00:00:00 GMTpublic java.lang.String getValue()
public AtomDate setValue(java.lang.String value)
value
- The serialized string form of the datepublic AtomDate setValue(java.util.Date date)
date
- A java.util.Datejava.lang.NullPointerException
- if date
is null
public AtomDate setValue(java.util.Calendar calendar)
calendar
- a java.util.Calendarpublic AtomDate setValue(long timestamp)
timestamp
- The number of milliseconds since January 1, 1970, 00:00:00 GMTpublic java.util.Date getDate()
public java.util.Calendar getCalendar()
public long getTime()
public java.lang.String toString()
toString
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public java.lang.Object clone()
clone
in class java.lang.Object
public static java.util.Date parse(java.lang.String date)
date
- The serialized string form of the datepublic static java.lang.String format(java.util.Date date)
d
- A java.util.Datepublic static AtomDate valueOf(java.lang.String value)
value
- The serialized string form of the datepublic static AtomDate valueOf(java.util.Date value)
value
- a java.util.Datepublic static AtomDate valueOf(java.util.Calendar value)
value
- A java.util.Calendarpublic static AtomDate valueOf(long value)
value
- The number of milliseconds since January 1, 1970, 00:00:00 GMTCopyright © 2010 - 2020 Adobe. All Rights Reserved