com.google.gwt.i18n.client.impl
Class DateRecord

java.lang.Object
  extended by java.util.Date
      extended by com.google.gwt.i18n.client.impl.DateRecord
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Comparable<java.util.Date>

public class DateRecord
extends java.util.Date

Implementation detail of DateTimeFormat -- not a public API and subject to change. DateRecord class exposes almost the same set of interface as Date class with only a few exceptions. The main purpose is the record all the information during parsing phase and resolve them in a later time when all information can be processed together.

See Also:
Serialized Form

Field Summary
static int AM
           
static int PM
           
 
Constructor Summary
DateRecord()
          Initialize DateExt object with default value.
 
Method Summary
 boolean calcDate(java.util.Date date, boolean strict)
          calcDate uses all the field available so far to fill a Date object.
 void setAmbiguousYear(boolean ambiguousYear)
          Set ambiguous year field.
 void setAmpm(int ampm)
          Set morning/afternoon field.
 void setDayOfMonth(int day)
          Set dayOfMonth field.
 void setDayOfWeek(int dayOfWeek)
          Set dayOfWeek field.
 void setEra(int era)
          Set Era field.
 void setHours(int hours)
          Set hour field.
 void setMilliseconds(int milliseconds)
          Set milliseconds field.
 void setMinutes(int minutes)
          Set minute field.
 void setMonth(int month)
          Set month field.
 void setSeconds(int seconds)
          Set seconds field.
 void setTzOffset(int tzOffset)
          Set timezone offset, in minutes.
 void setYear(int value)
          Set year field.
 
Methods inherited from class java.util.Date
after, before, clone, compareTo, equals, getDate, getDay, getHours, getMinutes, getMonth, getSeconds, getTime, getTimezoneOffset, getYear, hashCode, parse, setDate, setTime, toGMTString, toLocaleString, toString, UTC
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

AM

public static final int AM
See Also:
Constant Field Values

PM

public static final int PM
See Also:
Constant Field Values
Constructor Detail

DateRecord

public DateRecord()
Initialize DateExt object with default value. Here we use -1 for most of the field to indicate that field is not set.

Method Detail

calcDate

public boolean calcDate(java.util.Date date,
                        boolean strict)
calcDate uses all the field available so far to fill a Date object. For those information that is not provided, the existing value in 'date' will be kept. Ambiguous year will be resolved after the date/time values are resolved. If the strict option is set to true, calcDate will calculate certain invalid dates by wrapping around as needed. For example, February 30 will wrap to March 2.

Parameters:
date - The Date object being filled. Its value should be set to an acceptable default before pass in to this method
strict - true to be strict when parsing
Returns:
true if successful, otherwise false.

setAmbiguousYear

public void setAmbiguousYear(boolean ambiguousYear)
Set ambiguous year field. This flag indicates that a 2 digit years's century need to be determined by its date/time value. This can only be resolved after its date/time is known.

Parameters:
ambiguousYear - true if it is ambiguous year.

setAmpm

public void setAmpm(int ampm)
Set morning/afternoon field.

Parameters:
ampm - ampm value.

setDayOfMonth

public void setDayOfMonth(int day)
Set dayOfMonth field.

Parameters:
day - dayOfMonth value

setDayOfWeek

public void setDayOfWeek(int dayOfWeek)
Set dayOfWeek field.

Parameters:
dayOfWeek - day of the week.

setEra

public void setEra(int era)
Set Era field.

Parameters:
era - era value being set.

setHours

public void setHours(int hours)
Set hour field.

Overrides:
setHours in class java.util.Date
Parameters:
hours - hour value.

setMilliseconds

public void setMilliseconds(int milliseconds)
Set milliseconds field.

Parameters:
milliseconds - milliseconds value.

setMinutes

public void setMinutes(int minutes)
Set minute field.

Overrides:
setMinutes in class java.util.Date
Parameters:
minutes - minute value.

setMonth

public void setMonth(int month)
Set month field.

Overrides:
setMonth in class java.util.Date
Parameters:
month - month value.

setSeconds

public void setSeconds(int seconds)
Set seconds field.

Overrides:
setSeconds in class java.util.Date
Parameters:
seconds - second value.

setTzOffset

public void setTzOffset(int tzOffset)
Set timezone offset, in minutes.

Parameters:
tzOffset - timezone offset.

setYear

public void setYear(int value)
Set year field.

Overrides:
setYear in class java.util.Date
Parameters:
value - year value.