biz.c24.io.api.data
Class ISO8601Time

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

public class ISO8601Time
extends ISO8601Value

An object representing an ISO8601 time.

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:
ISO8601TimeDataType, 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
ISO8601Time()
          Constructs a new instance.
ISO8601Time(Date date)
          Constructs a new instance from the specified date.
ISO8601Time(long date)
          Constructs a new instance from the specified date.
ISO8601Time(long date, TimeZone timeZone)
          Constructs a new instance from the specified date.
ISO8601Time(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 ISO8601Time create(String str)
          Returns an instance parsed from the specified string.
 boolean equals(Object obj)
           
protected static TimeZone getDefaultTimeZone()
          Returns default time zone.
 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 getSecond()
          Returns the second component of the time.
 short getZoneHour()
          Returns the hour component of the time zone.
 short getZoneMinute()
          Returns the minute component of the time zone.
 int getZoneOffset()
          Returns the zone offset in milliseconds.
 int hashCode()
           
 boolean isNegative()
          Returns whether this is a negative time.
 boolean isUTC()
          Returns whether this is in UTC.
 boolean isZoneNegative()
          Returns whether the time zone if 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, getTimeZone, getTimeZoneInternal, setTimeZone, setTimeZone, setZoneOffsetInternal
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ISO8601Time

public ISO8601Time()
Constructs a new instance.


ISO8601Time

public ISO8601Time(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.

ISO8601Time

public ISO8601Time(Date date)
Constructs a new instance from the specified date. Default (local) time zone is used.

Parameters:
date - The date to convert from.

ISO8601Time

public ISO8601Time(long date)
Constructs a new instance from the specified date. Default (local) time zone is used.

Parameters:
date - The date to convert from.

ISO8601Time

public ISO8601Time(long date,
                   TimeZone timeZone)
Constructs a new instance from the specified date.

Parameters:
date - The date to convert from.
timeZone - The time zone to use.
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 ISO8601Time create(String str)
                          throws DateFormatException
Returns an instance parsed from the specified string.

This convenience factory method works as if by invoking the ISO8601Time(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.

getZoneHour

public short getZoneHour()
Returns the hour component of the time zone.

Returns:
The time zone hour.

getZoneMinute

public short getZoneMinute()
Returns the minute component of the time zone.

Returns:
The time zone minute.

isZoneNegative

public boolean isZoneNegative()
Returns whether the time zone if negative.

Returns:
Whether the time zone is negative.

getZoneOffset

public int getZoneOffset()
Returns the zone offset in milliseconds.

Returns:
The zone offset.

isUTC

public boolean isUTC()
Returns whether this is in UTC. A date/time is in UTC if a 'Z' appears at the end of the lexical representation or if it contains a time zone.

Returns:
Whether this is in UTC.

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 is a negative time.

Returns:
Whether this time is negative.

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

getDefaultTimeZone

protected static TimeZone getDefaultTimeZone()
Returns default time zone.

Returns:
default time zone

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.