Package com.adobe.xmp.impl
Class XMPDateTimeImpl
- java.lang.Object
-
- com.adobe.xmp.impl.XMPDateTimeImpl
-
- All Implemented Interfaces:
XMPDateTime
,Comparable
public class XMPDateTimeImpl extends Object implements XMPDateTime
The implementation ofXMPDateTime
. Internally acalendar
is used plus an additional nano seconds field, becauseCalendar
supports only milli seconds. ThenanoSeconds
convers only the resolution beyond a milli second.- Since:
- 16.02.2006
-
-
Constructor Summary
Constructors Constructor Description XMPDateTimeImpl()
Creates anXMPDateTime
-instance with the current time in the default time zone.XMPDateTimeImpl(String strValue)
Creates anXMPDateTime
-instance from an ISO 8601 string.XMPDateTimeImpl(Calendar calendar)
Creates anXMPDateTime
-instance from a calendar.XMPDateTimeImpl(Date date, TimeZone timeZone)
Creates anXMPDateTime
-instance from aDate
and aTimeZone
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(Object dt)
Calendar
getCalendar()
int
getDay()
int
getHour()
String
getISO8601String()
int
getMinute()
int
getMonth()
int
getNanoSecond()
int
getSecond()
TimeZone
getTimeZone()
int
getYear()
boolean
hasDate()
This flag is set either by parsing or by setting year, month or day.boolean
hasTime()
This flag is set either by parsing or by setting hours, minutes, seconds or milliseconds.boolean
hasTimeZone()
This flag is set either by parsing or by setting hours, minutes, seconds or milliseconds.void
setDay(int day)
void
setHour(int hour)
void
setMinute(int minute)
void
setMonth(int month)
void
setNanoSecond(int nanoSecond)
void
setSecond(int second)
void
setTimeZone(TimeZone timeZone)
void
setYear(int year)
String
toString()
-
-
-
Constructor Detail
-
XMPDateTimeImpl
public XMPDateTimeImpl()
Creates anXMPDateTime
-instance with the current time in the default time zone.
-
XMPDateTimeImpl
public XMPDateTimeImpl(Calendar calendar)
Creates anXMPDateTime
-instance from a calendar.- Parameters:
calendar
- aCalendar
-
XMPDateTimeImpl
public XMPDateTimeImpl(Date date, TimeZone timeZone)
Creates anXMPDateTime
-instance from aDate
and aTimeZone
.- Parameters:
date
- a date describing an absolute point in timetimeZone
- a TimeZone how to interpret the date
-
XMPDateTimeImpl
public XMPDateTimeImpl(String strValue) throws XMPException
Creates anXMPDateTime
-instance from an ISO 8601 string.- Parameters:
strValue
- an ISO 8601 string- Throws:
XMPException
- If the string is a non-conform ISO 8601 string, an exception is thrown
-
-
Method Detail
-
getYear
public int getYear()
- Specified by:
getYear
in interfaceXMPDateTime
- Returns:
- Returns the year, can be negative.
- See Also:
XMPDateTime.getYear()
-
setYear
public void setYear(int year)
- Specified by:
setYear
in interfaceXMPDateTime
- Parameters:
year
- Sets the year- See Also:
XMPDateTime.setYear(int)
-
getMonth
public int getMonth()
- Specified by:
getMonth
in interfaceXMPDateTime
- Returns:
- Returns The month in the range 1..12.
- See Also:
XMPDateTime.getMonth()
-
setMonth
public void setMonth(int month)
- Specified by:
setMonth
in interfaceXMPDateTime
- Parameters:
month
- Sets the month 1..12- See Also:
XMPDateTime.setMonth(int)
-
getDay
public int getDay()
- Specified by:
getDay
in interfaceXMPDateTime
- Returns:
- Returns the day of the month in the range 1..31.
- See Also:
XMPDateTime.getDay()
-
setDay
public void setDay(int day)
- Specified by:
setDay
in interfaceXMPDateTime
- Parameters:
day
- Sets the day 1..31- See Also:
XMPDateTime.setDay(int)
-
getHour
public int getHour()
- Specified by:
getHour
in interfaceXMPDateTime
- Returns:
- Returns hour - The hour in the range 0..23.
- See Also:
XMPDateTime.getHour()
-
setHour
public void setHour(int hour)
- Specified by:
setHour
in interfaceXMPDateTime
- Parameters:
hour
- Sets the hour in the range 0..23.- See Also:
XMPDateTime.setHour(int)
-
getMinute
public int getMinute()
- Specified by:
getMinute
in interfaceXMPDateTime
- Returns:
- Returns the minute in the range 0..59.
- See Also:
XMPDateTime.getMinute()
-
setMinute
public void setMinute(int minute)
- Specified by:
setMinute
in interfaceXMPDateTime
- Parameters:
minute
- Sets the minute in the range 0..59.- See Also:
XMPDateTime.setMinute(int)
-
getSecond
public int getSecond()
- Specified by:
getSecond
in interfaceXMPDateTime
- Returns:
- Returns the second in the range 0..59.
- See Also:
XMPDateTime.getSecond()
-
setSecond
public void setSecond(int second)
- Specified by:
setSecond
in interfaceXMPDateTime
- Parameters:
second
- Sets the second in the range 0..59.- See Also:
XMPDateTime.setSecond(int)
-
getNanoSecond
public int getNanoSecond()
- Specified by:
getNanoSecond
in interfaceXMPDateTime
- Returns:
- Returns milli-, micro- and nano seconds. Nanoseconds within a second, often left as zero?
- See Also:
XMPDateTime.getNanoSecond()
-
setNanoSecond
public void setNanoSecond(int nanoSecond)
- Specified by:
setNanoSecond
in interfaceXMPDateTime
- Parameters:
nanoSecond
- Sets the milli-, micro- and nano seconds. Granularity goes down to milli seconds.- See Also:
XMPDateTime.setNanoSecond(int)
-
compareTo
public int compareTo(Object dt)
- Specified by:
compareTo
in interfaceComparable
- See Also:
Comparable.compareTo(Object)
-
getTimeZone
public TimeZone getTimeZone()
- Specified by:
getTimeZone
in interfaceXMPDateTime
- Returns:
- Returns the time zone.
- See Also:
XMPDateTime.getTimeZone()
-
setTimeZone
public void setTimeZone(TimeZone timeZone)
- Specified by:
setTimeZone
in interfaceXMPDateTime
- Parameters:
timeZone
- a time zone to set- See Also:
XMPDateTime.setTimeZone(TimeZone)
-
hasDate
public boolean hasDate()
Description copied from interface:XMPDateTime
This flag is set either by parsing or by setting year, month or day.- Specified by:
hasDate
in interfaceXMPDateTime
- Returns:
- Returns true if the XMPDateTime object has a date portion.
- See Also:
XMPDateTime.hasDate()
-
hasTime
public boolean hasTime()
Description copied from interface:XMPDateTime
This flag is set either by parsing or by setting hours, minutes, seconds or milliseconds.- Specified by:
hasTime
in interfaceXMPDateTime
- Returns:
- Returns true if the XMPDateTime object has a time portion.
- See Also:
XMPDateTime.hasTime()
-
hasTimeZone
public boolean hasTimeZone()
Description copied from interface:XMPDateTime
This flag is set either by parsing or by setting hours, minutes, seconds or milliseconds.- Specified by:
hasTimeZone
in interfaceXMPDateTime
- Returns:
- Returns true if the XMPDateTime object has a defined timezone.
- See Also:
XMPDateTime.hasTimeZone()
-
getCalendar
public Calendar getCalendar()
- Specified by:
getCalendar
in interfaceXMPDateTime
- Returns:
- Returns a
Calendar
(only with milli second precision).
Note: the dates before Oct 15th 1585 (which normally fall into validity of the Julian calendar) are also rendered internally as Gregorian dates. - See Also:
XMPDateTime.getCalendar()
-
getISO8601String
public String getISO8601String()
- Specified by:
getISO8601String
in interfaceXMPDateTime
- Returns:
- Returns the ISO 8601 string representation of the date and time.
- See Also:
XMPDateTime.getISO8601String()
-
-