Package com.ibm.icu.text
Class DateFormat.Field
- java.lang.Object
-
- java.text.AttributedCharacterIterator.Attribute
-
- java.text.Format.Field
-
- com.ibm.icu.text.DateFormat.Field
-
- All Implemented Interfaces:
java.io.Serializable
- Direct Known Subclasses:
ChineseDateFormat.Field
- Enclosing class:
- DateFormat
public static class DateFormat.Field extends java.text.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
-
-
Field Summary
Fields Modifier and Type Field Description static DateFormat.Field
AM_PM
Constant identifying the time of day indicator(am/pm).static DateFormat.Field
AM_PM_MIDNIGHT_NOON
Constant identifying the am/pm/midnight/noon field.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
FLEXIBLE_DAY_PERIOD
Constant identifying the flexible day period 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
RELATED_YEAR
Deprecated.This API is ICU internal only.static DateFormat.Field
SECOND
Constant identifying the second field.static DateFormat.Field
TIME_SEPARATOR
Deprecated.This API is ICU internal only.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.
-
Constructor Summary
Constructors Modifier Constructor Description protected
Field(java.lang.String name, int calendarField)
Constructs aDateFormat.Field
with the given name and theCalendar
field which this attribute represents.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getCalendarField()
Returns theCalendar
field associated with this attribute.static DateFormat.Field
ofCalendarField(int calendarField)
Returns theField
constant that corresponds to theCalendar
fieldcalendarField
.protected java.lang.Object
readResolve()
Resolves instances being deserialized to the predefined constants.
-
-
-
Field Detail
-
AM_PM
public static final DateFormat.Field AM_PM
Constant identifying the time of day indicator(am/pm).
-
DAY_OF_MONTH
public static final DateFormat.Field DAY_OF_MONTH
Constant identifying the day of month field.
-
DAY_OF_WEEK
public static final DateFormat.Field DAY_OF_WEEK
Constant identifying the day of week field.
-
DAY_OF_WEEK_IN_MONTH
public static final DateFormat.Field DAY_OF_WEEK_IN_MONTH
Constant identifying the day of week in month field.
-
DAY_OF_YEAR
public static final DateFormat.Field DAY_OF_YEAR
Constant identifying the day of year field.
-
ERA
public static final DateFormat.Field ERA
Constant identifying the era field.
-
HOUR_OF_DAY0
public static final DateFormat.Field HOUR_OF_DAY0
Constant identifying the hour(0-23) of day field.
-
HOUR_OF_DAY1
public static final DateFormat.Field HOUR_OF_DAY1
Constant identifying the hour(1-24) of day field.
-
HOUR0
public static final DateFormat.Field HOUR0
Constant identifying the hour(0-11) field.
-
HOUR1
public static final DateFormat.Field HOUR1
Constant identifying the hour(1-12) field.
-
MILLISECOND
public static final DateFormat.Field MILLISECOND
Constant identifying the millisecond field.
-
MINUTE
public static final DateFormat.Field MINUTE
Constant identifying the minute field.
-
MONTH
public static final DateFormat.Field MONTH
Constant identifying the month field.
-
SECOND
public static final DateFormat.Field SECOND
Constant identifying the second field.
-
TIME_ZONE
public static final DateFormat.Field TIME_ZONE
Constant identifying the time zone field.
-
WEEK_OF_MONTH
public static final DateFormat.Field WEEK_OF_MONTH
Constant identifying the week of month field.
-
WEEK_OF_YEAR
public static final DateFormat.Field WEEK_OF_YEAR
Constant identifying the week of year field.
-
YEAR
public static final DateFormat.Field YEAR
Constant identifying the year field.
-
DOW_LOCAL
public static final DateFormat.Field DOW_LOCAL
Constant identifying the local day of week field.
-
EXTENDED_YEAR
public static final DateFormat.Field EXTENDED_YEAR
Constant identifying the extended year field.
-
JULIAN_DAY
public static final DateFormat.Field JULIAN_DAY
Constant identifying the Julian day field.
-
MILLISECONDS_IN_DAY
public static final DateFormat.Field MILLISECONDS_IN_DAY
Constant identifying the milliseconds in day field.
-
YEAR_WOY
public static final DateFormat.Field YEAR_WOY
Constant identifying the year used with week of year field.
-
QUARTER
public static final DateFormat.Field QUARTER
Constant identifying the quarter field.
-
RELATED_YEAR
@Deprecated public static final DateFormat.Field RELATED_YEAR
Deprecated.This API is ICU internal only.Constant identifying the related year field.
-
AM_PM_MIDNIGHT_NOON
public static final DateFormat.Field AM_PM_MIDNIGHT_NOON
Constant identifying the am/pm/midnight/noon field.
-
FLEXIBLE_DAY_PERIOD
public static final DateFormat.Field FLEXIBLE_DAY_PERIOD
Constant identifying the flexible day period field.
-
TIME_SEPARATOR
@Deprecated public static final DateFormat.Field TIME_SEPARATOR
Deprecated.This API is ICU internal only.Constant identifying the time separator field.
-
-
Constructor Detail
-
Field
protected Field(java.lang.String name, int calendarField)
Constructs aDateFormat.Field
with the given name and theCalendar
field which this attribute represents. Use -1 forcalendarField
if this field does not have a correspondingCalendar
field.- Parameters:
name
- Name of the attributecalendarField
-Calendar
field constant
-
-
Method Detail
-
ofCalendarField
public static DateFormat.Field ofCalendarField(int calendarField)
Returns theField
constant that corresponds to theCalendar
fieldcalendarField
. If there is no correspondingField
is available, null is returned.- Parameters:
calendarField
-Calendar
field constant- Returns:
Field
associated with thecalendarField
, or null if no associatedField
is available.- Throws:
java.lang.IllegalArgumentException
- ifcalendarField
is not a validCalendar
field constant.
-
getCalendarField
public int getCalendarField()
Returns theCalendar
field associated with this attribute. If there is no correspondingCalendar
available, this will return -1.- Returns:
Calendar
constant for this attribute.
-
readResolve
protected java.lang.Object readResolve() throws java.io.InvalidObjectException
Resolves instances being deserialized to the predefined constants.- Overrides:
readResolve
in classjava.text.AttributedCharacterIterator.Attribute
- Throws:
java.io.InvalidObjectException
- if the constant could not be resolved.
-
-