org.exolab.castor.types
public class Time extends DateTimeBase
Describes an XML schema Time.
The format is defined by W3C XML Schema Recommendation and ISO8601 i.e (-)hh:mm:ss.sss(Z|(+|-)hh:mm)
Currently deep support of milli seconds is not implemented. This implementation only support up to 3 figures for milli-seconds.
Version: $Revision: 1.2 $
See Also: DateTimeBase
Constructor Summary | |
---|---|
Time() | |
Time(short[] values)
Constructs a XML Schema Time instance given all the values of
the different fields.
| |
Time(long l)
Constructs a XML Schema Time instance given a long representing the time in milliseconds.
| |
Time(String time)
Constructs a Time given a string representation. |
Method Summary | |
---|---|
short | getCentury() |
short | getDay() |
void | getDay(short day) |
short | getMonth() |
void | getMonth(short month) |
short[] | getValues()
returns an array of short with all the fields that describe
this time type.
|
short | getYear() |
void | getYear(short year) |
static Object | parse(String str)
parses a String and converts it into a java.lang.Object |
static Time | parseTime(String str)
parses a String and converts it into a Time. |
void | setCentury(short century) |
void | setValues(short[] values)
Sets all the fields by reading the values in an array.
|
Date | toDate()
converts this Time into a local java Date. |
String | toString()
convert this Time to a string
The format is defined by W3C XML Schema Recommendation and ISO8601
i.e (-)hh:mm:ss.sss(Z|(+|-)hh:mm) |
Parameters: values an array of shorts that represent the different fields of Time.
Parameters: l The long value that represents the time instance.
Parameters: time the string representation of the Time to instantiate
Note:the time zone is not included.
Returns: an array of short with all the fields that describe this time type.
Parameters: str the string to parse
Returns: the java.lang.Object represented by the string
Throws: ParseException a parse exception is thrown if the string to parse does not follow the rigth format (see the description of this class)
Parameters: str the string to parse
Returns: the Time represented by the string
Throws: ParseException a parse exception is thrown if the string to parse does not follow the rigth format (see the description of this class)
if a Time Zone is specificied it has to be set by using
setZone
.
Parameters: values an array of shorts with the values
the array is supposed to be of length 4 and ordered like that:
Returns: a local date representing this Time
Returns: a string representing this Time