Class DateTimeFieldType
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
DateTimeFieldType.StandardDateTimeFieldType
A field type defines the type of the field, such as hourOfDay.
If does not directly enable any calculations, however it does provide a
getField(Chronology) method that returns the actual calculation engine
for a particular chronology.
It also provides access to the related DurationFieldTypes.
Instances of DateTimeFieldType are singletons.
They can be compared using ==.
If required, you can create your own field, for example a quarterOfYear.
You must create a subclass of DateTimeFieldType that defines the field type.
This class returns the actual calculation engine from getField(Chronology).
The subclass should implement equals and hashCode.
- Since:
- 1.0
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static class -
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final byteOrdinal values for standard field types.private static final DateTimeFieldTypeThe centuryOfEra field type.(package private) static final byteOrdinal values for standard field types.private static final DateTimeFieldTypeThe clockhourOfDay field type.(package private) static final byteOrdinal values for standard field types.private static final DateTimeFieldTypeThe clockhourOfHalfday field type.(package private) static final byteOrdinal values for standard field types.private static final DateTimeFieldTypeThe dayOfMonth field type.(package private) static final byteOrdinal values for standard field types.private static final DateTimeFieldTypeThe dayOfWeek field type.(package private) static final byteOrdinal values for standard field types.private static final DateTimeFieldTypeThe dayOfYear field type.(package private) static final byteOrdinal values for standard field types.private static final DateTimeFieldTypeThe era field type.(package private) static final byteOrdinal values for standard field types.private static final DateTimeFieldTypeThe halfday field type.(package private) static final byteOrdinal values for standard field types.private static final DateTimeFieldTypeThe hourOfDay field type.(package private) static final byteOrdinal values for standard field types.private static final DateTimeFieldTypeThe hourOfHalfday field type.private final StringThe name of the field.(package private) static final byteOrdinal values for standard field types.private static final DateTimeFieldTypeThe millisOfDay field type.(package private) static final byteOrdinal values for standard field types.private static final DateTimeFieldTypeThe millisOfSecond field type.(package private) static final byteOrdinal values for standard field types.private static final DateTimeFieldTypeThe minuteOfDay field type.(package private) static final byteOrdinal values for standard field types.private static final DateTimeFieldTypeThe minuteOfHour field type.(package private) static final byteOrdinal values for standard field types.private static final DateTimeFieldTypeThe monthOfYear field type.(package private) static final byteOrdinal values for standard field types.private static final DateTimeFieldTypeThe secondOfDay field type.(package private) static final byteOrdinal values for standard field types.private static final DateTimeFieldTypeThe secondOfMinute field type.private static final longSerialization version(package private) static final byteOrdinal values for standard field types.private static final DateTimeFieldTypeThe weekOfWeekyear field type.(package private) static final byteOrdinal values for standard field types.(package private) static final byteOrdinal values for standard field types.private static final DateTimeFieldTypeThe weekyearOfCentury field type.private static final DateTimeFieldTypeThe weekyear field type.(package private) static final byteOrdinal values for standard field types.(package private) static final byteOrdinal values for standard field types.private static final DateTimeFieldTypeThe yearOfCentury field type.(package private) static final byteOrdinal values for standard field types.private static final DateTimeFieldTypeThe yearOfEra field type.private static final DateTimeFieldTypeThe year field type. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic DateTimeFieldTypeGet the century of era field type.static DateTimeFieldTypeGet the hour of day (offset to 1-24) field type.static DateTimeFieldTypeGet the hour of am/pm (offset to 1-12) field type.static DateTimeFieldTypeGet the day of month field type.static DateTimeFieldTypeGet the day of week field type.static DateTimeFieldTypeGet the day of year field type.static DateTimeFieldTypeera()Get the era field type.abstract DurationFieldTypeGet the duration unit of the field.abstract DateTimeFieldgetField(Chronology chronology) Gets a suitable field for this type from the given Chronology.getName()Get the name of the field.abstract DurationFieldTypeGet the duration range of the field.static DateTimeFieldTypeGet the AM(0) PM(1) field type.static DateTimeFieldTypeGet the hour of day (0-23) field type.static DateTimeFieldTypeGet the hour of am/pm (0-11) field type.booleanisSupported(Chronology chronology) Checks whether this field supported in the given Chronology.static DateTimeFieldTypeGet the millis of day field type.static DateTimeFieldTypeGet the millis of second field type.static DateTimeFieldTypeGet the minute of day field type.static DateTimeFieldTypeGet the minute of hour field type.static DateTimeFieldTypeGet the month of year field type.static DateTimeFieldTypeGet the second of day field type.static DateTimeFieldTypeGet the second of minute field type.toString()Get a suitable debug string.static DateTimeFieldTypeGet the week of a week based year field type.static DateTimeFieldTypeweekyear()Get the year of a week based year field type.static DateTimeFieldTypeGet the year of a week based year within a century field type.static DateTimeFieldTypeyear()Get the year field type.static DateTimeFieldTypeGet the year of century field type.static DateTimeFieldTypeGet the year of era field type.
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDSerialization version- See Also:
-
ERA
static final byte ERAOrdinal values for standard field types.- See Also:
-
YEAR_OF_ERA
static final byte YEAR_OF_ERAOrdinal values for standard field types.- See Also:
-
CENTURY_OF_ERA
static final byte CENTURY_OF_ERAOrdinal values for standard field types.- See Also:
-
YEAR_OF_CENTURY
static final byte YEAR_OF_CENTURYOrdinal values for standard field types.- See Also:
-
YEAR
static final byte YEAROrdinal values for standard field types.- See Also:
-
DAY_OF_YEAR
static final byte DAY_OF_YEAROrdinal values for standard field types.- See Also:
-
MONTH_OF_YEAR
static final byte MONTH_OF_YEAROrdinal values for standard field types.- See Also:
-
DAY_OF_MONTH
static final byte DAY_OF_MONTHOrdinal values for standard field types.- See Also:
-
WEEKYEAR_OF_CENTURY
static final byte WEEKYEAR_OF_CENTURYOrdinal values for standard field types.- See Also:
-
WEEKYEAR
static final byte WEEKYEAROrdinal values for standard field types.- See Also:
-
WEEK_OF_WEEKYEAR
static final byte WEEK_OF_WEEKYEAROrdinal values for standard field types.- See Also:
-
DAY_OF_WEEK
static final byte DAY_OF_WEEKOrdinal values for standard field types.- See Also:
-
HALFDAY_OF_DAY
static final byte HALFDAY_OF_DAYOrdinal values for standard field types.- See Also:
-
HOUR_OF_HALFDAY
static final byte HOUR_OF_HALFDAYOrdinal values for standard field types.- See Also:
-
CLOCKHOUR_OF_HALFDAY
static final byte CLOCKHOUR_OF_HALFDAYOrdinal values for standard field types.- See Also:
-
CLOCKHOUR_OF_DAY
static final byte CLOCKHOUR_OF_DAYOrdinal values for standard field types.- See Also:
-
HOUR_OF_DAY
static final byte HOUR_OF_DAYOrdinal values for standard field types.- See Also:
-
MINUTE_OF_DAY
static final byte MINUTE_OF_DAYOrdinal values for standard field types.- See Also:
-
MINUTE_OF_HOUR
static final byte MINUTE_OF_HOUROrdinal values for standard field types.- See Also:
-
SECOND_OF_DAY
static final byte SECOND_OF_DAYOrdinal values for standard field types.- See Also:
-
SECOND_OF_MINUTE
static final byte SECOND_OF_MINUTEOrdinal values for standard field types.- See Also:
-
MILLIS_OF_DAY
static final byte MILLIS_OF_DAYOrdinal values for standard field types.- See Also:
-
MILLIS_OF_SECOND
static final byte MILLIS_OF_SECONDOrdinal values for standard field types.- See Also:
-
ERA_TYPE
The era field type. -
YEAR_OF_ERA_TYPE
The yearOfEra field type. -
CENTURY_OF_ERA_TYPE
The centuryOfEra field type. -
YEAR_OF_CENTURY_TYPE
The yearOfCentury field type. -
YEAR_TYPE
The year field type. -
DAY_OF_YEAR_TYPE
The dayOfYear field type. -
MONTH_OF_YEAR_TYPE
The monthOfYear field type. -
DAY_OF_MONTH_TYPE
The dayOfMonth field type. -
WEEKYEAR_OF_CENTURY_TYPE
The weekyearOfCentury field type. -
WEEKYEAR_TYPE
The weekyear field type. -
WEEK_OF_WEEKYEAR_TYPE
The weekOfWeekyear field type. -
DAY_OF_WEEK_TYPE
The dayOfWeek field type. -
HALFDAY_OF_DAY_TYPE
The halfday field type. -
HOUR_OF_HALFDAY_TYPE
The hourOfHalfday field type. -
CLOCKHOUR_OF_HALFDAY_TYPE
The clockhourOfHalfday field type. -
CLOCKHOUR_OF_DAY_TYPE
The clockhourOfDay field type. -
HOUR_OF_DAY_TYPE
The hourOfDay field type. -
MINUTE_OF_DAY_TYPE
The minuteOfDay field type. -
MINUTE_OF_HOUR_TYPE
The minuteOfHour field type. -
SECOND_OF_DAY_TYPE
The secondOfDay field type. -
SECOND_OF_MINUTE_TYPE
The secondOfMinute field type. -
MILLIS_OF_DAY_TYPE
The millisOfDay field type. -
MILLIS_OF_SECOND_TYPE
The millisOfSecond field type. -
iName
The name of the field.
-
-
Constructor Details
-
DateTimeFieldType
Constructor.- Parameters:
name- the name to use
-
-
Method Details
-
millisOfSecond
Get the millis of second field type.- Returns:
- the DateTimeFieldType constant
-
millisOfDay
Get the millis of day field type.This measures the milliseconds from the start of the day on the local time-line. On a daylight saving date, this means that some values will be missed (in spring) or duplicated (in autumn/fall).
- Returns:
- the DateTimeFieldType constant
-
secondOfMinute
Get the second of minute field type.- Returns:
- the DateTimeFieldType constant
-
secondOfDay
Get the second of day field type.This measures the seconds from the start of the day on the local time-line. On a daylight saving date, this means that some values will be missed (in spring) or duplicated (in autumn/fall).
- Returns:
- the DateTimeFieldType constant
-
minuteOfHour
Get the minute of hour field type.- Returns:
- the DateTimeFieldType constant
-
minuteOfDay
Get the minute of day field type.This measures the minutes from the start of the day on the local time-line. On a daylight saving date, this means that some values will be missed (in spring) or duplicated (in autumn/fall).
- Returns:
- the DateTimeFieldType constant
-
hourOfDay
Get the hour of day (0-23) field type.- Returns:
- the DateTimeFieldType constant
-
clockhourOfDay
Get the hour of day (offset to 1-24) field type.- Returns:
- the DateTimeFieldType constant
-
hourOfHalfday
Get the hour of am/pm (0-11) field type.- Returns:
- the DateTimeFieldType constant
-
clockhourOfHalfday
Get the hour of am/pm (offset to 1-12) field type.- Returns:
- the DateTimeFieldType constant
-
halfdayOfDay
Get the AM(0) PM(1) field type.- Returns:
- the DateTimeFieldType constant
-
dayOfWeek
Get the day of week field type.- Returns:
- the DateTimeFieldType constant
-
dayOfMonth
Get the day of month field type.- Returns:
- the DateTimeFieldType constant
-
dayOfYear
Get the day of year field type.- Returns:
- the DateTimeFieldType constant
-
weekOfWeekyear
Get the week of a week based year field type.- Returns:
- the DateTimeFieldType constant
-
weekyear
Get the year of a week based year field type.- Returns:
- the DateTimeFieldType constant
-
weekyearOfCentury
Get the year of a week based year within a century field type.- Returns:
- the DateTimeFieldType constant
-
monthOfYear
Get the month of year field type.- Returns:
- the DateTimeFieldType constant
-
year
Get the year field type.- Returns:
- the DateTimeFieldType constant
-
yearOfEra
Get the year of era field type.- Returns:
- the DateTimeFieldType constant
-
yearOfCentury
Get the year of century field type.- Returns:
- the DateTimeFieldType constant
-
centuryOfEra
Get the century of era field type.- Returns:
- the DateTimeFieldType constant
-
era
Get the era field type.- Returns:
- the DateTimeFieldType constant
-
getName
Get the name of the field.By convention, names follow a pattern of "dddOfRrr", where "ddd" represents the (singular) duration unit field name and "Rrr" represents the (singular) duration range field name. If the range field is not applicable, then the name of the field is simply the (singular) duration field name.
- Returns:
- field name
-
getDurationType
Get the duration unit of the field.- Returns:
- duration unit of the field, never null
-
getRangeDurationType
Get the duration range of the field.- Returns:
- duration range of the field, null if unbounded
-
getField
Gets a suitable field for this type from the given Chronology.- Parameters:
chronology- the chronology to use, null means ISOChronology in default zone- Returns:
- a suitable field
-
isSupported
Checks whether this field supported in the given Chronology.- Parameters:
chronology- the chronology to use, null means ISOChronology in default zone- Returns:
- true if supported
-
toString
Get a suitable debug string.
-