biz.c24.io.api.data
Class ISO8601Duration

java.lang.Object
  extended by biz.c24.io.api.data.ISO8601Value
      extended by biz.c24.io.api.data.ISO8601Duration
All Implemented Interfaces:
Serializable, Comparable

public class ISO8601Duration
extends ISO8601Value

An object representing an ISO8601 duration.

Warning: Serialized objects of this class or of a deployed class which is derived from it may not be compatible with future releases of C24 Integreation Objects. The current serialization support is appropriate for short term storage or RMI between applications running the same version of C24 Integreation Objects.

See Also:
ISO8601DurationDataType, Serialized Form

Field Summary
 
Fields inherited from class biz.c24.io.api.data.ISO8601Value
CALENDAR, IO_ISO8601_TIME_ZONE_PRESENT, IO_ISO8601_TIME_ZONE_ZERO, TIME_ZONE_UTC, timeZone
 
Constructor Summary
ISO8601Duration()
          Constructs a new instance.
ISO8601Duration(Date date)
          Constructs a new instance from the specified date.
ISO8601Duration(long date)
          Constructs a new instance from the specified date.
ISO8601Duration(String str)
          Constructs a new instance from the specified string.
 
Method Summary
protected  void adjustTimeZoneInternal()
          Internal calculations required for adjusting this object to the new time zone value.
 int compareTo(Object o)
           
static ISO8601Duration create(String str)
          Returns an instance parsed from the specified string.
 boolean equals(Object obj)
           
 short getDay()
          Returns the day component of the date.
 short getHour()
          Returns the hour component of the time.
 short getMilliSecond()
          Returns the milli second component of the time.
 short getMinute()
          Returns the minute component of the time.
 short getMonth()
          Returns the month component of the date.
 short getSecond()
          Returns the second component of the time.
 short getYear()
          Returns the year component of the date.
 int hashCode()
           
 boolean isNegative()
          Returns whether this duration is negative.
protected  void setInternal(long date)
          Sets internal date/time values using date value.
 Date toDate()
          Converts this object into a Date.
 long toLong()
          Converts this object into a long.
 String toString()
           
 
Methods inherited from class biz.c24.io.api.data.ISO8601Value
adjustTimeZone, getDefaultTimeZone, getTimeZone, getTimeZoneInternal, setTimeZone, setTimeZone, setZoneOffsetInternal
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ISO8601Duration

public ISO8601Duration()
Constructs a new instance.


ISO8601Duration

public ISO8601Duration(String str)
                throws ParserException
Constructs a new instance from the specified string.

Parameters:
str - The string to parse.
Throws:
ParserException - If the string could not be parsed.

ISO8601Duration

public ISO8601Duration(Date date)
Constructs a new instance from the specified date.

Parameters:
date - The date to convert from.

ISO8601Duration

public ISO8601Duration(long date)
Constructs a new instance from the specified date.

Parameters:
date - The date to convert from.
Method Detail

setInternal

protected void setInternal(long date)
Description copied from class: ISO8601Value
Sets internal date/time values using date value.

Specified by:
setInternal in class ISO8601Value
Parameters:
date - date value to use

create

public static ISO8601Duration create(String str)
                              throws DateFormatException
Returns an instance parsed from the specified string.

This convenience factory method works as if by invoking the ISO8601Duration(String) constructor; any ParserException thrown by the constructor is caught and wrapped in a new DateFormatException object, which is then thrown.

This method is provided for use in situations where it is known that the given string is a legal value, for example for constants declared within in a program, and so it would be considered a programming error for the string not to parse as such. The constructor, which throws a ParserException directly, should be used in situations where a value is being constructed from user input or from some other source that may be prone to errors.

Parameters:
str - The string to parse.
Returns:
A value parsed from the string.
Throws:
DateFormatException - If the string could not be parsed.
NullPointerException - If str is null.

getYear

public short getYear()
Returns the year component of the date.

Returns:
The year.

getMonth

public short getMonth()
Returns the month component of the date.

Returns:
The month.

getDay

public short getDay()
Returns the day component of the date.

Returns:
The day.

getHour

public short getHour()
Returns the hour component of the time.

Returns:
The hour.

getMinute

public short getMinute()
Returns the minute component of the time.

Returns:
The minute.

getSecond

public short getSecond()
Returns the second component of the time.

Returns:
The second.

getMilliSecond

public short getMilliSecond()
Returns the milli second component of the time.

Returns:
The milli second.

isNegative

public boolean isNegative()
Returns whether this duration is negative.

Returns:
Whether this is a negative duration.

toDate

public Date toDate()
Description copied from class: ISO8601Value
Converts this object into a Date.

Specified by:
toDate in class ISO8601Value
Returns:
The date.

toLong

public long toLong()
Description copied from class: ISO8601Value
Converts this object into a long.

Specified by:
toLong in class ISO8601Value
Returns:
The date.

toString

public String toString()
Overrides:
toString in class Object

compareTo

public int compareTo(Object o)

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

adjustTimeZoneInternal

protected void adjustTimeZoneInternal()
Description copied from class: ISO8601Value
Internal calculations required for adjusting this object to the new time zone value.

Specified by:
adjustTimeZoneInternal in class ISO8601Value


C24 Technologies © 2002-2012: All Rights Reserved.