com.ibm.icu.text
Class DateFormat.Field

java.lang.Object
  extended by java.text.AttributedCharacterIterator.Attribute
      extended by java.text.Format.Field
          extended by com.ibm.icu.text.DateFormat.Field
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
ChineseDateFormat.Field
Enclosing class:
DateFormat

public static class DateFormat.Field
extends Format.Field

The instances of this inner class are used as attribute keys and values in AttributedCharacterIterator that DateFormat.formatToCharacterIterator() method returns.

There is no public constructor to this class, the only instances are the constants defined here.

See Also:
Serialized Form
Status:
Stable ICU 3.8.

Field Summary
static DateFormat.Field AM_PM
          Constant identifying the time of day indicator(am/pm).
static DateFormat.Field DAY_OF_MONTH
          Constant identifying the day of month field.
static DateFormat.Field DAY_OF_WEEK
          Constant identifying the day of week field.
static DateFormat.Field DAY_OF_WEEK_IN_MONTH
          Constant identifying the day of week in month field.
static DateFormat.Field DAY_OF_YEAR
          Constant identifying the day of year field.
static DateFormat.Field DOW_LOCAL
          Constant identifying the local day of week field.
static DateFormat.Field ERA
          Constant identifying the era field.
static DateFormat.Field EXTENDED_YEAR
          Constant identifying the extended year field.
static DateFormat.Field HOUR_OF_DAY0
          Constant identifying the hour(0-23) of day field.
static DateFormat.Field HOUR_OF_DAY1
          Constant identifying the hour(1-24) of day field.
static DateFormat.Field HOUR0
          Constant identifying the hour(0-11) field.
static DateFormat.Field HOUR1
          Constant identifying the hour(1-12) field.
static DateFormat.Field JULIAN_DAY
          Constant identifying the Julian day field.
static DateFormat.Field MILLISECOND
          Constant identifying the millisecond field.
static DateFormat.Field MILLISECONDS_IN_DAY
          Constant identifying the milliseconds in day field.
static DateFormat.Field MINUTE
          Constant identifying the minute field.
static DateFormat.Field MONTH
          Constant identifying the month field.
static DateFormat.Field QUARTER
          Constant identifying the quarter field.
static DateFormat.Field SECOND
          Constant identifying the second field.
static DateFormat.Field TIME_ZONE
          Constant identifying the time zone field.
static DateFormat.Field WEEK_OF_MONTH
          Constant identifying the week of month field.
static DateFormat.Field WEEK_OF_YEAR
          Constant identifying the week of year field.
static DateFormat.Field YEAR
          Constant identifying the year field.
static DateFormat.Field YEAR_WOY
          Constant identifying the year used with week of year field.
 
Fields inherited from class java.text.AttributedCharacterIterator.Attribute
INPUT_METHOD_SEGMENT, LANGUAGE, READING
 
Constructor Summary
protected DateFormat.Field(String name, int calendarField)
          Constructs a DateFormat.Field with the given name and the Calendar field which this attribute represents.
 
Method Summary
 int getCalendarField()
          Returns the Calendar field associated with this attribute.
static DateFormat.Field ofCalendarField(int calendarField)
          Returns the Field constant that corresponds to the Calendar field calendarField.
protected  Object readResolve()
          Resolves instances being deserialized to the predefined constants.
 
Methods inherited from class java.text.AttributedCharacterIterator.Attribute
equals, getName, hashCode, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

AM_PM

public static final DateFormat.Field AM_PM
Constant identifying the time of day indicator(am/pm).

Status:
Stable ICU 3.8.

DAY_OF_MONTH

public static final DateFormat.Field DAY_OF_MONTH
Constant identifying the day of month field.

Status:
Stable ICU 3.8.

DAY_OF_WEEK

public static final DateFormat.Field DAY_OF_WEEK
Constant identifying the day of week field.

Status:
Stable ICU 3.8.

DAY_OF_WEEK_IN_MONTH

public static final DateFormat.Field DAY_OF_WEEK_IN_MONTH
Constant identifying the day of week in month field.

Status:
Stable ICU 3.8.

DAY_OF_YEAR

public static final DateFormat.Field DAY_OF_YEAR
Constant identifying the day of year field.

Status:
Stable ICU 3.8.

ERA

public static final DateFormat.Field ERA
Constant identifying the era field.

Status:
Stable ICU 3.8.

HOUR_OF_DAY0

public static final DateFormat.Field HOUR_OF_DAY0
Constant identifying the hour(0-23) of day field.

Status:
Stable ICU 3.8.

HOUR_OF_DAY1

public static final DateFormat.Field HOUR_OF_DAY1
Constant identifying the hour(1-24) of day field.

Status:
Stable ICU 3.8.

HOUR0

public static final DateFormat.Field HOUR0
Constant identifying the hour(0-11) field.

Status:
Stable ICU 3.8.

HOUR1

public static final DateFormat.Field HOUR1
Constant identifying the hour(1-12) field.

Status:
Stable ICU 3.8.

MILLISECOND

public static final DateFormat.Field MILLISECOND
Constant identifying the millisecond field.

Status:
Stable ICU 3.8.

MINUTE

public static final DateFormat.Field MINUTE
Constant identifying the minute field.

Status:
Stable ICU 3.8.

MONTH

public static final DateFormat.Field MONTH
Constant identifying the month field.

Status:
Stable ICU 3.8.

SECOND

public static final DateFormat.Field SECOND
Constant identifying the second field.

Status:
Stable ICU 3.8.

TIME_ZONE

public static final DateFormat.Field TIME_ZONE
Constant identifying the time zone field.

Status:
Stable ICU 3.8.

WEEK_OF_MONTH

public static final DateFormat.Field WEEK_OF_MONTH
Constant identifying the week of month field.

Status:
Stable ICU 3.8.

WEEK_OF_YEAR

public static final DateFormat.Field WEEK_OF_YEAR
Constant identifying the week of year field.

Status:
Stable ICU 3.8.

YEAR

public static final DateFormat.Field YEAR
Constant identifying the year field.

Status:
Stable ICU 3.8.

DOW_LOCAL

public static final DateFormat.Field DOW_LOCAL
Constant identifying the local day of week field.

Status:
Stable ICU 3.8.

EXTENDED_YEAR

public static final DateFormat.Field EXTENDED_YEAR
Constant identifying the extended year field.

Status:
Stable ICU 3.8.

JULIAN_DAY

public static final DateFormat.Field JULIAN_DAY
Constant identifying the Julian day field.

Status:
Stable ICU 3.8.

MILLISECONDS_IN_DAY

public static final DateFormat.Field MILLISECONDS_IN_DAY
Constant identifying the milliseconds in day field.

Status:
Stable ICU 3.8.

YEAR_WOY

public static final DateFormat.Field YEAR_WOY
Constant identifying the year used with week of year field.

Status:
Stable ICU 3.8.

QUARTER

public static final DateFormat.Field QUARTER
Constant identifying the quarter field.

Status:
Stable ICU 3.8.
Constructor Detail

DateFormat.Field

protected DateFormat.Field(String name,
                           int calendarField)
Constructs a DateFormat.Field with the given name and the Calendar field which this attribute represents. Use -1 for calendarField if this field does not have a corresponding Calendar field.

Parameters:
name - Name of the attribute
calendarField - Calendar field constant
Status:
Stable ICU 3.8.
Method Detail

ofCalendarField

public static DateFormat.Field ofCalendarField(int calendarField)
Returns the Field constant that corresponds to the Calendar field calendarField. If there is no corresponding Field is available, null is returned.

Parameters:
calendarField - Calendar field constant
Returns:
Field associated with the calendarField, or null if no associated Field is available.
Throws:
IllegalArgumentException - if calendarField is not a valid Calendar field constant.
Status:
Stable ICU 3.8.

getCalendarField

public int getCalendarField()
Returns the Calendar field associated with this attribute. If there is no corresponding Calendar available, this will return -1.

Returns:
Calendar constant for this attribute.
Status:
Stable ICU 3.8.

readResolve

protected Object readResolve()
                      throws InvalidObjectException
Resolves instances being deserialized to the predefined constants.

Overrides:
readResolve in class AttributedCharacterIterator.Attribute
Throws:
InvalidObjectException - if the constant could not be resolved.
Status:
Stable ICU 3.8.


Copyright (c) 2011 IBM Corporation and others.