Identifies a field, such as year or minuteOfHour, in a chronology-neutral way.
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
DurationFieldType
s.
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)
.
centuryOfEra
public static DateTimeFieldType centuryOfEra()
Get the century of era field type.
- the DateTimeFieldType constant
clockhourOfDay
public static DateTimeFieldType clockhourOfDay()
Get the hour of day (offset to 1-24) field type.
- the DateTimeFieldType constant
clockhourOfHalfday
public static DateTimeFieldType clockhourOfHalfday()
Get the hour of am/pm (offset to 1-12) field type.
- the DateTimeFieldType constant
dayOfMonth
public static DateTimeFieldType dayOfMonth()
Get the day of month field type.
- the DateTimeFieldType constant
dayOfWeek
public static DateTimeFieldType dayOfWeek()
Get the day of week field type.
- the DateTimeFieldType constant
dayOfYear
public static DateTimeFieldType dayOfYear()
Get the day of year field type.
- the DateTimeFieldType constant
era
public static DateTimeFieldType era()
Get the era field type.
- the DateTimeFieldType constant
getDurationType
public abstract DurationFieldType getDurationType()
Get the duration unit of the field.
- duration unit of the field, never null
getField
public abstract DateTimeField getField(Chronology chronology)
Gets a suitable field for this type from the given Chronology.
chronology
- the chronology to use, null means ISOChronology in default zone
getName
public String 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.
getRangeDurationType
public abstract DurationFieldType getRangeDurationType()
Get the duration range of the field.
- duration range of the field, null if unbounded
halfdayOfDay
public static DateTimeFieldType halfdayOfDay()
Get the AM(0) PM(1) field type.
- the DateTimeFieldType constant
hourOfDay
public static DateTimeFieldType hourOfDay()
Get the hour of day (0-23) field type.
- the DateTimeFieldType constant
hourOfHalfday
public static DateTimeFieldType hourOfHalfday()
Get the hour of am/pm (0-11) field type.
- the DateTimeFieldType constant
isSupported
public boolean isSupported(Chronology chronology)
Checks whether this field supported in the given Chronology.
chronology
- the chronology to use, null means ISOChronology in default zone
millisOfDay
public static DateTimeFieldType millisOfDay()
Get the millis of day field type.
- the DateTimeFieldType constant
millisOfSecond
public static DateTimeFieldType millisOfSecond()
Get the millis of second field type.
- the DateTimeFieldType constant
minuteOfDay
public static DateTimeFieldType minuteOfDay()
Get the minute of day field type.
- the DateTimeFieldType constant
minuteOfHour
public static DateTimeFieldType minuteOfHour()
Get the minute of hour field type.
- the DateTimeFieldType constant
monthOfYear
public static DateTimeFieldType monthOfYear()
Get the month of year field type.
- the DateTimeFieldType constant
secondOfDay
public static DateTimeFieldType secondOfDay()
Get the second of day field type.
- the DateTimeFieldType constant
secondOfMinute
public static DateTimeFieldType secondOfMinute()
Get the second of minute field type.
- the DateTimeFieldType constant
toString
public String toString()
Get a suitable debug string.
weekOfWeekyear
public static DateTimeFieldType weekOfWeekyear()
Get the week of a week based year field type.
- the DateTimeFieldType constant
weekyear
public static DateTimeFieldType weekyear()
Get the year of a week based year field type.
- the DateTimeFieldType constant
weekyearOfCentury
public static DateTimeFieldType weekyearOfCentury()
Get the year of a week based year within a century field type.
- the DateTimeFieldType constant
year
public static DateTimeFieldType year()
Get the year field type.
- the DateTimeFieldType constant
yearOfCentury
public static DateTimeFieldType yearOfCentury()
Get the year of century field type.
- the DateTimeFieldType constant
yearOfEra
public static DateTimeFieldType yearOfEra()
Get the year of era field type.
- the DateTimeFieldType constant