|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.exolab.castor.types.DateTimeBase
org.exolab.castor.types.Time
public class Time
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)
Deep support of fractional seconds is not implemented. This implementation only supports fractional second resolution of milliseconds.
DateTimeBase,
Serialized Form| Field Summary |
|---|
| Fields inherited from class org.exolab.castor.types.DateTimeBase |
|---|
EQUALS, GREATER_THAN, INDETERMINATE, LESS_THAN, MAX_TIME_ZONE_COMPARISON_OFFSET, WRONGLY_PLACED |
| Constructor Summary | |
|---|---|
Time()
No-arg constructor. |
|
Time(long l)
Constructs a XML Schema Time instance given a long representing the time in milliseconds. |
|
Time(long l,
boolean utc)
Constructs a XML Schema Time instance given a long representing the time in milliseconds. |
|
Time(short[] values)
Constructs a XML Schema Time instance given all the values of the different fields. |
|
Time(String time)
Constructs a Time given a string representation. |
|
| Method Summary | |
|---|---|
short |
getCentury()
|
short |
getDay()
|
short |
getMonth()
|
short[] |
getValues()
returns an array of short with all the fields that describe this time type. |
short |
getYear()
|
boolean |
hasCentury()
|
boolean |
hasDay()
|
boolean |
hasIsNegative()
|
boolean |
hasMonth()
|
boolean |
hasYear()
|
boolean |
isNegative()
|
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)
Set the century field. |
void |
setDay(short month)
Sets the Day Field. |
void |
setMonth(short month)
Sets the Month Field. |
void |
setNegative()
Set the negative field to true. |
void |
setValues(short[] values)
Sets all the fields by reading the values in an array. |
void |
setYear(short year)
Sets the Year field. |
Date |
toDate()
converts this Time into a local java Date. |
long |
toLong()
Converts this Time instance into a long value based on UTC time zone. |
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) |
| Methods inherited from class org.exolab.castor.types.DateTimeBase |
|---|
addDuration, appendDateString, appendTimeString, appendTimeZoneString, clone, compareTo, equal, equals, getHour, getMilli, getMinute, getSeconds, getZoneHour, getZoneMinute, hashCode, hasHour, hasMilli, hasMinute, hasSeconds, isLeap, isUTC, isZoneNegative, normalize, parseDay, parseMonth, parseTime, parseTimeZone, parseYear, setDateFormatTimeZone, setDateFormatTimeZone, setHour, setMilliSecond, setMinute, setSecond, setSecond, setUTC, setZone, setZoneHour, setZoneMinute, setZoneNegative, toCalendar |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public Time()
public Time(short[] values)
values - an array of shorts that represent the different fields of Time.public Time(long l)
l - The long value that represents the time instance.
public Time(long l,
boolean utc)
l - The long value that represents the time instance.utc - Does the long value represent a UTC time?
public Time(String time)
throws ParseException
time - the string representation of the Time to instantiate
ParseException - a parse exception is thrown if the string to parse
does not follow the rigth format (see the description
of this class)| Method Detail |
|---|
public void setValues(short[] values)
if a Time Zone is specified it has to be set by using
setZone.
setValues in class DateTimeBasevalues - an array of shorts with the values the array is supposed to be
of length 4 and ordered like that:
public short[] getValues()
Note:the time zone is not included.
getValues in class DateTimeBasepublic long toLong()
public Date toDate()
toDate in class DateTimeBasepublic String toString()
toString in class Object
public static Object parse(String str)
throws ParseException
str - the string to parse
ParseException - a parse exception is thrown if the string to parse
does not follow the rigth format (see the description
of this class)
public static Time parseTime(String str)
throws ParseException
str - the string to parse
ParseException - a parse exception is thrown if the string to parse
does not follow the rigth format (see the description
of this class)public boolean hasIsNegative()
hasIsNegative in class DateTimeBasepublic boolean isNegative()
isNegative in class DateTimeBasepublic void setNegative()
DateTimeBase
setNegative in class DateTimeBasepublic boolean hasCentury()
hasCentury in class DateTimeBasepublic short getCentury()
getCentury in class DateTimeBasepublic void setCentury(short century)
DateTimeBase
setCentury in class DateTimeBasecentury - the value to setpublic boolean hasYear()
hasYear in class DateTimeBasepublic short getYear()
getYear in class DateTimeBasepublic void setYear(short year)
DateTimeBase
setYear in class DateTimeBaseyear - the year to setpublic boolean hasMonth()
hasMonth in class DateTimeBasepublic short getMonth()
getMonth in class DateTimeBasepublic void setMonth(short month)
DateTimeBase
setMonth in class DateTimeBasemonth - the value to set uppublic boolean hasDay()
hasDay in class DateTimeBasepublic short getDay()
getDay in class DateTimeBasepublic void setDay(short month)
DateTimeBase
setDay in class DateTimeBasemonth - the value to set up
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||