GDateSpecification Interface

com.bea.xml
GDateSpecification Interface

public interface GDateSpecification

Represents an XML Schema-compatible Gregorian date.

Both the immutable GDate and the mutable GDateBuilder are GDateSpecifications. Use this interface where you want to allow callers to pass any implementation of a GDate.

Related Topics

GDate
XmlCalendar


All Known Implementing Classes
GDateBuilder, GDate

Field Summary

public static final int
HAS_DAY
Day of month is specified.
public static final int
HAS_MONTH
Month of year is specified.
public static final int
HAS_TIME
Time of day is specified.
public static final int
HAS_TIMEZONE
Timezone is specified.
public static final int
HAS_YEAR
Year is specified.
 

Method Summary

public String
canonicalString()
The canonical string representation.
public int
compareToGDate(GDateSpecification gdatespec)
Comparison to another GDate.
public int
getBuiltinTypeCode()
Returns the builtin type code for the shape of the information contained in this instance, or 0 if the instance doesn't contain information corresponding to a Schema type.
public XmlCalendar
getCalendar()
Retrieves the value of the current time as an XmlCalendar.
public Date
getDate()
Retrieves the value of the current time as a java.util.Date instance.
public int
getDay()
Gets the day-of-month.
public int
getFlags()
Returns a combination of flags indicating the information contained by this GDate.
public BigDecimal
getFraction()
Gets the fraction-of-second.
public int
getHour()
Gets the hour-of-day.
public int
getJulianDate()
Returns the Julian date corresponding to this Gregorian date.
public int
getMillisecond()
Gets the rounded millisecond value.
public int
getMinute()
Gets the minute-of-hour.
public int
getMonth()
Gets the month-of-year.
public int
getSecond()
Gets the second-of-minute.
public int
getTimeZoneHour()
Gets the time zone hour.
public int
getTimeZoneMinute()
Gets the time zone minutes.
public int
getTimeZoneSign()
Gets the time zone sign.
public int
getYear()
Gets the year.
public boolean
hasDate()
True if this date/time specification specifies a full date (year, month, day)
public boolean
hasDay()
True if this date/time specification specifies a day-of-month.
public boolean
hasMonth()
True if this date/time specification specifies a month-of-year.
public boolean
hasTime()
True if this date/time specification specifies a time-of-day.
public boolean
hasTimeZone()
True if this date/time specification specifies a timezone.
public boolean
hasYear()
True if this date/time specification specifies a year.
public boolean
isImmutable()
True if this GDate specification is immutable.
public boolean
isValid()
True if this GDate corresponds to a valid gregorian date value in XML schema.
public String
toString()
The natural string representation.

Field Detail

HAS_DAY

public static final int HAS_DAY
Day of month is specified. See GDateSpecification.getFlags().


HAS_MONTH

public static final int HAS_MONTH
Month of year is specified. See GDateSpecification.getFlags().


HAS_TIME

public static final int HAS_TIME
Time of day is specified. See GDateSpecification.getFlags().


HAS_TIMEZONE

public static final int HAS_TIMEZONE
Timezone is specified. See GDateSpecification.getFlags().


HAS_YEAR

public static final int HAS_YEAR
Year is specified. See GDateSpecification.getFlags().

 

Method Detail

canonicalString() Method

public String canonicalString()
The canonical string representation. Specific moments or times-of-day in a specified timezone are normalized to UTC time to produce a canonical string form for them. Other recurring time specifications keep their timezone information.


compareToGDate(GDateSpecification) Method

public int compareToGDate(GDateSpecification gdatespec)
Comparison to another GDate. Two instances are incomparable if they have different amounts of information.

Parameters

gdatespec
the date to compare against.

getBuiltinTypeCode() Method

public int getBuiltinTypeCode()
Returns the builtin type code for the shape of the information contained in this instance, or 0 if the instance doesn't contain information corresponding to a Schema type.

Value will be equal to SchemaType.BTC_NOT_BUILTIN, SchemaType.BTC_G_YEAR, SchemaType.BTC_G_YEAR_MONTH, SchemaType.BTC_G_MONTH, SchemaType.BTC_G_MONTH_DAY, SchemaType.BTC_G_DAY, SchemaType.BTC_DATE, SchemaType.BTC_DATE_TIME, or SchemaType.BTC_TIME.


getCalendar() Method

public XmlCalendar getCalendar()
Retrieves the value of the current time as an XmlCalendar.

XmlCalendar is a subclass of GregorianCalendar which is slightly customized to match XML schema date rules.

The returned XmlCalendar has only those time and date fields set that are reflected in the GDate object. Because of the way the Calendar contract works, any information in the isSet() vanishes as soon as you view any unset field using get() methods. This means that if it is important to understand which date fields are set, you must call isSet() first before get().


getDate() Method

public Date getDate()
Retrieves the value of the current time as a java.util.Date instance.


getDay() Method

public int getDay()
Gets the day-of-month. The first day of each month is 1.


getFlags() Method

public int getFlags()
Returns a combination of flags indicating the information contained by this GDate. The five flags are GDateSpecification.HAS_TIMEZONE, GDateSpecification.HAS_YEAR, GDateSpecification.HAS_MONTH, GDateSpecification.HAS_DAY, and GDateSpecification.HAS_TIME.


getFraction() Method

public BigDecimal getFraction()
Gets the fraction-of-second. Range from 0 (inclusive) to 1 (exclusive).


getHour() Method

public int getHour()
Gets the hour-of-day. Midnight is 0, and 11PM is 23.


getJulianDate() Method

public int getJulianDate()
Returns the Julian date corresponding to this Gregorian date. The Julian date (JD) is a continuous count of days from 1 January 4713 BC (= -4712 January 1).


getMillisecond() Method

public int getMillisecond()
Gets the rounded millisecond value. Range from 0 to 999


getMinute() Method

public int getMinute()
Gets the minute-of-hour. Range from 0 to 59.


getMonth() Method

public int getMonth()
Gets the month-of-year. January is 1.


getSecond() Method

public int getSecond()
Gets the second-of-minute. Range from 0 to 59.


getTimeZoneHour() Method

public int getTimeZoneHour()
Gets the time zone hour. This is always positive: for the sign, look at getTimeZoneSign().


getTimeZoneMinute() Method

public int getTimeZoneMinute()
Gets the time zone minutes. This is always positive: for the sign, look at getTimeZoneSign().


getTimeZoneSign() Method

public int getTimeZoneSign()
Gets the time zone sign. For time zones east of GMT, this is positive; for time zones west, this is negative.


getYear() Method

public int getYear()
Gets the year. Should be a four-digit year specification.


hasDate() Method

public boolean hasDate()
True if this date/time specification specifies a full date (year, month, day)


hasDay() Method

public boolean hasDay()
True if this date/time specification specifies a day-of-month.


hasMonth() Method

public boolean hasMonth()
True if this date/time specification specifies a month-of-year.


hasTime() Method

public boolean hasTime()
True if this date/time specification specifies a time-of-day.


hasTimeZone() Method

public boolean hasTimeZone()
True if this date/time specification specifies a timezone.


hasYear() Method

public boolean hasYear()
True if this date/time specification specifies a year.


isImmutable() Method

public boolean isImmutable()
True if this GDate specification is immutable. GDate returns true, and GDateBuilder returns false.


isValid() Method

public boolean isValid()
True if this GDate corresponds to a valid gregorian date value in XML schema.


toString() Method

public String toString()
The natural string representation. This represents the information that is available, including timezone. For types that correspond to defined schema types (schemaBuiltinTypeCode() > 0), this provides the natural lexical representation. When both time and timezone are specified, this string is not the canonical representation unless the timezone is UTC (Z) (since the same moment in time can be expressed in different timezones). To get a canonical string, use the canonicalString() method.

Overrides
Object.toString()