org.exolab.castor.types

Class GMonth

Implemented Interfaces:
Cloneable, java.io.Serializable

public class GMonth
extends DateTimeBase

Describe an XML schema gMonth type.

The format is defined by W3C XML Schema Recommendation and ISO8601 i.e --MM--(Z|(+|-)hh:mm)

Version:
$Revision: 7289 $
Authors:
Arnaud Blandin
Edward Kuns
See Also:
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

GMonth()
public only for the generated source code
GMonth(String gmonth)
Constructs a GMonth from a string value.
GMonth(int month)
Constructs a XML Schema GMonth instance given all the values of the different fields.
GMonth(short month)
Constructs a XML Schema GMonth instance given all the values of the different fields.

Method Summary

short
getCentury()
short
getDay()
short
getHour()
short
getMilli()
short
getMinute()
short
getSeconds()
short[]
getValues()
Returns an array of short with all the fields that describe this gDay type.
short
getYear()
boolean
hasCentury()
boolean
hasDay()
boolean
hasHour()
boolean
hasIsNegative()
boolean
hasMilli()
boolean
hasMinute()
boolean
hasSeconds()
boolean
hasYear()
boolean
isNegative()
static Object
parse(String str)
parse a String and convert it into an java.lang.Object
static GMonth
parseGMonth(String str)
parse a String and convert it into a GMonth.
void
setCentury(short century)
Set the century field.
void
setDay(short month)
Sets the Day Field.
void
setHour(short hour)
Sets the hour field for this date/time type.
void
setMilliSecond(short millisecond)
Sets the millisecond field for this date/time type.
void
setMinute(short minute)
set the minute field for this date/time type.
void
setNegative()
Set the negative field to true.
void
setSecond(short second)
Sets the seconds field for this date/time type, not including the fractional seconds.
void
setValues(short[] values)
Sets all the fields by reading the values in an array

if a Time Zone is specificied it has to be set by using setZone.

void
setYear(short year)
Sets the Year field.
java.util.Date
toDate()
converts this GMonth into a local java Date.
String
toString()
convert this GMonth to a string The format is defined by W3C XML Schema recommendation and ISO8601 i.e --MM--(Z|(+|-)hh:mm)

Methods inherited from class org.exolab.castor.types.DateTimeBase

addDuration, appendDateString, appendTimeString, appendTimeZoneString, clone, compareTo, equal, equals, getCentury, getDay, getHour, getMilli, getMinute, getMonth, getSeconds, getValues, getYear, getZoneHour, getZoneMinute, hasCentury, hasDay, hasHour, hasIsNegative, hasMilli, hasMinute, hasMonth, hasSeconds, hasYear, hashCode, isLeap, isNegative, isUTC, isZoneNegative, normalize, parseDay, parseMonth, parseTime, parseTimeZone, parseYear, setCentury, setDateFormatTimeZone, setDateFormatTimeZone, setDay, setHour, setMilliSecond, setMinute, setMonth, setNegative, setSecond, setSecond, setUTC, setValues, setYear, setZone, setZoneHour, setZoneMinute, setZoneNegative, toCalendar, toDate

Constructor Details

GMonth

public GMonth()
public only for the generated source code

GMonth

public GMonth(String gmonth)
            throws ParseException
Constructs a GMonth from a string value.
Parameters:
gmonth - the string representation of the GMonth to instantiate

GMonth

public GMonth(int month)
Constructs a XML Schema GMonth instance given all the values of the different fields. By default a GMonth is not UTC and is local.
Parameters:
month - the month value.

GMonth

public GMonth(short month)
Constructs a XML Schema GMonth instance given all the values of the different fields. By default a GMonth is not UTC and is local.
Parameters:
month - the month value.

Method Details

getCentury

public short getCentury()
Overrides:
getCentury in interface DateTimeBase

getDay

public short getDay()
Overrides:
getDay in interface DateTimeBase

getHour

public short getHour()
Overrides:
getHour in interface DateTimeBase

getMilli

public short getMilli()
Overrides:
getMilli in interface DateTimeBase

getMinute

public short getMinute()
Overrides:
getMinute in interface DateTimeBase

getSeconds

public short getSeconds()
Overrides:
getSeconds in interface DateTimeBase

getValues

public short[] getValues()
Returns an array of short with all the fields that describe this gDay type.

Note:the time zone is not included.

Overrides:
getValues in interface DateTimeBase
Returns:
an array of short with all the fields that describe this Date type.

getYear

public short getYear()
Overrides:
getYear in interface DateTimeBase

hasCentury

public boolean hasCentury()
Overrides:
hasCentury in interface DateTimeBase

hasDay

public boolean hasDay()
Overrides:
hasDay in interface DateTimeBase

hasHour

public boolean hasHour()
Overrides:
hasHour in interface DateTimeBase

hasIsNegative

public boolean hasIsNegative()
Overrides:
hasIsNegative in interface DateTimeBase

hasMilli

public boolean hasMilli()
Overrides:
hasMilli in interface DateTimeBase

hasMinute

public boolean hasMinute()
Overrides:
hasMinute in interface DateTimeBase

hasSeconds

public boolean hasSeconds()
Overrides:
hasSeconds in interface DateTimeBase

hasYear

public boolean hasYear()
Overrides:
hasYear in interface DateTimeBase

isNegative

public boolean isNegative()
Overrides:
isNegative in interface DateTimeBase

parse

public static Object parse(String str)
            throws ParseException
parse a String and convert it into an java.lang.Object
Parameters:
str - the string to parse
Returns:
an Object represented by the string

parseGMonth

public static GMonth parseGMonth(String str)
            throws ParseException
parse a String and convert it into a GMonth.
Parameters:
str - the string to parse
Returns:
the Date represented by the string

setCentury

public void setCentury(short century)
Set the century field. Note: year 0000 is not allowed.
Overrides:
setCentury in interface DateTimeBase
Parameters:
century - the value to set

setDay

public void setDay(short month)
Sets the Day Field. Note: This field is validated before the assignment is done.
Overrides:
setDay in interface DateTimeBase
Parameters:

setHour

public void setHour(short hour)
Sets the hour field for this date/time type.
Overrides:
setHour in interface DateTimeBase
Parameters:
hour - the hour to set

setMilliSecond

public void setMilliSecond(short millisecond)
Sets the millisecond field for this date/time type.
Overrides:
setMilliSecond in interface DateTimeBase
Parameters:
millisecond - the millisecond to set

setMinute

public void setMinute(short minute)
set the minute field for this date/time type.
Overrides:
setMinute in interface DateTimeBase
Parameters:
minute - the minute to set.

setNegative

public void setNegative()
Set the negative field to true.
Overrides:
setNegative in interface DateTimeBase

setSecond

public void setSecond(short second)
Sets the seconds field for this date/time type, not including the fractional seconds. Any fractional seconds previously set is unmodified.
Overrides:
setSecond in interface DateTimeBase
Parameters:
second - the second to set

setValues

public void setValues(short[] values)
Overrides:
setValues in interface DateTimeBase
Parameters:
values - an array of shorts with the values the array is supposed to be of length 1 and ordered like the following:
  • Month

setYear

public void setYear(short year)
Sets the Year field. Note: year 0000 is not allowed.
Overrides:
setYear in interface DateTimeBase
Parameters:
year - the year to set

toDate

public java.util.Date toDate()
converts this GMonth into a local java Date.
Overrides:
toDate in interface DateTimeBase
Returns:
a local date representing this Date.

toString

public String toString()
convert this GMonth to a string The format is defined by W3C XML Schema recommendation and ISO8601 i.e --MM--(Z|(+|-)hh:mm)
Returns:
a string representing this Date

Intalio Inc. (C) 1999-2008. All rights reserved http://www.intalio.com