Class DateTimeFieldType
- java.lang.Object
-
- org.joda.time.DateTimeFieldType
-
- All Implemented Interfaces:
java.io.Serializable
- Direct Known Subclasses:
DateTimeFieldType.StandardDateTimeFieldType
public abstract class DateTimeFieldType extends java.lang.Object implements java.io.SerializableIdentifies 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 relatedDurationFieldTypes.Instances of
DateTimeFieldTypeare singletons. They can be compared using==.If required, you can create your own field, for example a quarterOfYear. You must create a subclass of
DateTimeFieldTypethat defines the field type. This class returns the actual calculation engine fromgetField(Chronology). The subclass should implement equals and hashCode.- Since:
- 1.0
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classDateTimeFieldType.StandardDateTimeFieldType
-
Field Summary
Fields Modifier and Type Field Description (package private) static byteCENTURY_OF_ERAOrdinal values for standard field types.private static DateTimeFieldTypeCENTURY_OF_ERA_TYPEThe centuryOfEra field type.(package private) static byteCLOCKHOUR_OF_DAYOrdinal values for standard field types.private static DateTimeFieldTypeCLOCKHOUR_OF_DAY_TYPEThe clockhourOfDay field type.(package private) static byteCLOCKHOUR_OF_HALFDAYOrdinal values for standard field types.private static DateTimeFieldTypeCLOCKHOUR_OF_HALFDAY_TYPEThe clockhourOfHalfday field type.(package private) static byteDAY_OF_MONTHOrdinal values for standard field types.private static DateTimeFieldTypeDAY_OF_MONTH_TYPEThe dayOfMonth field type.(package private) static byteDAY_OF_WEEKOrdinal values for standard field types.private static DateTimeFieldTypeDAY_OF_WEEK_TYPEThe dayOfWeek field type.(package private) static byteDAY_OF_YEAROrdinal values for standard field types.private static DateTimeFieldTypeDAY_OF_YEAR_TYPEThe dayOfYear field type.(package private) static byteERAOrdinal values for standard field types.private static DateTimeFieldTypeERA_TYPEThe era field type.(package private) static byteHALFDAY_OF_DAYOrdinal values for standard field types.private static DateTimeFieldTypeHALFDAY_OF_DAY_TYPEThe halfday field type.(package private) static byteHOUR_OF_DAYOrdinal values for standard field types.private static DateTimeFieldTypeHOUR_OF_DAY_TYPEThe hourOfDay field type.(package private) static byteHOUR_OF_HALFDAYOrdinal values for standard field types.private static DateTimeFieldTypeHOUR_OF_HALFDAY_TYPEThe hourOfHalfday field type.private java.lang.StringiNameThe name of the field.(package private) static byteMILLIS_OF_DAYOrdinal values for standard field types.private static DateTimeFieldTypeMILLIS_OF_DAY_TYPEThe millisOfDay field type.(package private) static byteMILLIS_OF_SECONDOrdinal values for standard field types.private static DateTimeFieldTypeMILLIS_OF_SECOND_TYPEThe millisOfSecond field type.(package private) static byteMINUTE_OF_DAYOrdinal values for standard field types.private static DateTimeFieldTypeMINUTE_OF_DAY_TYPEThe minuteOfDay field type.(package private) static byteMINUTE_OF_HOUROrdinal values for standard field types.private static DateTimeFieldTypeMINUTE_OF_HOUR_TYPEThe minuteOfHour field type.(package private) static byteMONTH_OF_YEAROrdinal values for standard field types.private static DateTimeFieldTypeMONTH_OF_YEAR_TYPEThe monthOfYear field type.(package private) static byteSECOND_OF_DAYOrdinal values for standard field types.private static DateTimeFieldTypeSECOND_OF_DAY_TYPEThe secondOfDay field type.(package private) static byteSECOND_OF_MINUTEOrdinal values for standard field types.private static DateTimeFieldTypeSECOND_OF_MINUTE_TYPEThe secondOfMinute field type.private static longserialVersionUIDSerialization version(package private) static byteWEEK_OF_WEEKYEAROrdinal values for standard field types.private static DateTimeFieldTypeWEEK_OF_WEEKYEAR_TYPEThe weekOfWeekyear field type.(package private) static byteWEEKYEAROrdinal values for standard field types.(package private) static byteWEEKYEAR_OF_CENTURYOrdinal values for standard field types.private static DateTimeFieldTypeWEEKYEAR_OF_CENTURY_TYPEThe weekyearOfCentury field type.private static DateTimeFieldTypeWEEKYEAR_TYPEThe weekyear field type.(package private) static byteYEAROrdinal values for standard field types.(package private) static byteYEAR_OF_CENTURYOrdinal values for standard field types.private static DateTimeFieldTypeYEAR_OF_CENTURY_TYPEThe yearOfCentury field type.(package private) static byteYEAR_OF_ERAOrdinal values for standard field types.private static DateTimeFieldTypeYEAR_OF_ERA_TYPEThe yearOfEra field type.private static DateTimeFieldTypeYEAR_TYPEThe year field type.
-
Constructor Summary
Constructors Modifier Constructor Description protectedDateTimeFieldType(java.lang.String name)Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static DateTimeFieldTypecenturyOfEra()Get the century of era field type.static DateTimeFieldTypeclockhourOfDay()Get the hour of day (offset to 1-24) field type.static DateTimeFieldTypeclockhourOfHalfday()Get the hour of am/pm (offset to 1-12) field type.static DateTimeFieldTypedayOfMonth()Get the day of month field type.static DateTimeFieldTypedayOfWeek()Get the day of week field type.static DateTimeFieldTypedayOfYear()Get the day of year field type.static DateTimeFieldTypeera()Get the era field type.abstract DurationFieldTypegetDurationType()Get the duration unit of the field.abstract DateTimeFieldgetField(Chronology chronology)Gets a suitable field for this type from the given Chronology.java.lang.StringgetName()Get the name of the field.abstract DurationFieldTypegetRangeDurationType()Get the duration range of the field.static DateTimeFieldTypehalfdayOfDay()Get the AM(0) PM(1) field type.static DateTimeFieldTypehourOfDay()Get the hour of day (0-23) field type.static DateTimeFieldTypehourOfHalfday()Get the hour of am/pm (0-11) field type.booleanisSupported(Chronology chronology)Checks whether this field supported in the given Chronology.static DateTimeFieldTypemillisOfDay()Get the millis of day field type.static DateTimeFieldTypemillisOfSecond()Get the millis of second field type.static DateTimeFieldTypeminuteOfDay()Get the minute of day field type.static DateTimeFieldTypeminuteOfHour()Get the minute of hour field type.static DateTimeFieldTypemonthOfYear()Get the month of year field type.static DateTimeFieldTypesecondOfDay()Get the second of day field type.static DateTimeFieldTypesecondOfMinute()Get the second of minute field type.java.lang.StringtoString()Get a suitable debug string.static DateTimeFieldTypeweekOfWeekyear()Get the week of a week based year field type.static DateTimeFieldTypeweekyear()Get the year of a week based year field type.static DateTimeFieldTypeweekyearOfCentury()Get the year of a week based year within a century field type.static DateTimeFieldTypeyear()Get the year field type.static DateTimeFieldTypeyearOfCentury()Get the year of century field type.static DateTimeFieldTypeyearOfEra()Get the year of era field type.
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
Serialization version- See Also:
- Constant Field Values
-
ERA
static final byte ERA
Ordinal values for standard field types.- See Also:
- Constant Field Values
-
YEAR_OF_ERA
static final byte YEAR_OF_ERA
Ordinal values for standard field types.- See Also:
- Constant Field Values
-
CENTURY_OF_ERA
static final byte CENTURY_OF_ERA
Ordinal values for standard field types.- See Also:
- Constant Field Values
-
YEAR_OF_CENTURY
static final byte YEAR_OF_CENTURY
Ordinal values for standard field types.- See Also:
- Constant Field Values
-
YEAR
static final byte YEAR
Ordinal values for standard field types.- See Also:
- Constant Field Values
-
DAY_OF_YEAR
static final byte DAY_OF_YEAR
Ordinal values for standard field types.- See Also:
- Constant Field Values
-
MONTH_OF_YEAR
static final byte MONTH_OF_YEAR
Ordinal values for standard field types.- See Also:
- Constant Field Values
-
DAY_OF_MONTH
static final byte DAY_OF_MONTH
Ordinal values for standard field types.- See Also:
- Constant Field Values
-
WEEKYEAR_OF_CENTURY
static final byte WEEKYEAR_OF_CENTURY
Ordinal values for standard field types.- See Also:
- Constant Field Values
-
WEEKYEAR
static final byte WEEKYEAR
Ordinal values for standard field types.- See Also:
- Constant Field Values
-
WEEK_OF_WEEKYEAR
static final byte WEEK_OF_WEEKYEAR
Ordinal values for standard field types.- See Also:
- Constant Field Values
-
DAY_OF_WEEK
static final byte DAY_OF_WEEK
Ordinal values for standard field types.- See Also:
- Constant Field Values
-
HALFDAY_OF_DAY
static final byte HALFDAY_OF_DAY
Ordinal values for standard field types.- See Also:
- Constant Field Values
-
HOUR_OF_HALFDAY
static final byte HOUR_OF_HALFDAY
Ordinal values for standard field types.- See Also:
- Constant Field Values
-
CLOCKHOUR_OF_HALFDAY
static final byte CLOCKHOUR_OF_HALFDAY
Ordinal values for standard field types.- See Also:
- Constant Field Values
-
CLOCKHOUR_OF_DAY
static final byte CLOCKHOUR_OF_DAY
Ordinal values for standard field types.- See Also:
- Constant Field Values
-
HOUR_OF_DAY
static final byte HOUR_OF_DAY
Ordinal values for standard field types.- See Also:
- Constant Field Values
-
MINUTE_OF_DAY
static final byte MINUTE_OF_DAY
Ordinal values for standard field types.- See Also:
- Constant Field Values
-
MINUTE_OF_HOUR
static final byte MINUTE_OF_HOUR
Ordinal values for standard field types.- See Also:
- Constant Field Values
-
SECOND_OF_DAY
static final byte SECOND_OF_DAY
Ordinal values for standard field types.- See Also:
- Constant Field Values
-
SECOND_OF_MINUTE
static final byte SECOND_OF_MINUTE
Ordinal values for standard field types.- See Also:
- Constant Field Values
-
MILLIS_OF_DAY
static final byte MILLIS_OF_DAY
Ordinal values for standard field types.- See Also:
- Constant Field Values
-
MILLIS_OF_SECOND
static final byte MILLIS_OF_SECOND
Ordinal values for standard field types.- See Also:
- Constant Field Values
-
ERA_TYPE
private static final DateTimeFieldType ERA_TYPE
The era field type.
-
YEAR_OF_ERA_TYPE
private static final DateTimeFieldType YEAR_OF_ERA_TYPE
The yearOfEra field type.
-
CENTURY_OF_ERA_TYPE
private static final DateTimeFieldType CENTURY_OF_ERA_TYPE
The centuryOfEra field type.
-
YEAR_OF_CENTURY_TYPE
private static final DateTimeFieldType YEAR_OF_CENTURY_TYPE
The yearOfCentury field type.
-
YEAR_TYPE
private static final DateTimeFieldType YEAR_TYPE
The year field type.
-
DAY_OF_YEAR_TYPE
private static final DateTimeFieldType DAY_OF_YEAR_TYPE
The dayOfYear field type.
-
MONTH_OF_YEAR_TYPE
private static final DateTimeFieldType MONTH_OF_YEAR_TYPE
The monthOfYear field type.
-
DAY_OF_MONTH_TYPE
private static final DateTimeFieldType DAY_OF_MONTH_TYPE
The dayOfMonth field type.
-
WEEKYEAR_OF_CENTURY_TYPE
private static final DateTimeFieldType WEEKYEAR_OF_CENTURY_TYPE
The weekyearOfCentury field type.
-
WEEKYEAR_TYPE
private static final DateTimeFieldType WEEKYEAR_TYPE
The weekyear field type.
-
WEEK_OF_WEEKYEAR_TYPE
private static final DateTimeFieldType WEEK_OF_WEEKYEAR_TYPE
The weekOfWeekyear field type.
-
DAY_OF_WEEK_TYPE
private static final DateTimeFieldType DAY_OF_WEEK_TYPE
The dayOfWeek field type.
-
HALFDAY_OF_DAY_TYPE
private static final DateTimeFieldType HALFDAY_OF_DAY_TYPE
The halfday field type.
-
HOUR_OF_HALFDAY_TYPE
private static final DateTimeFieldType HOUR_OF_HALFDAY_TYPE
The hourOfHalfday field type.
-
CLOCKHOUR_OF_HALFDAY_TYPE
private static final DateTimeFieldType CLOCKHOUR_OF_HALFDAY_TYPE
The clockhourOfHalfday field type.
-
CLOCKHOUR_OF_DAY_TYPE
private static final DateTimeFieldType CLOCKHOUR_OF_DAY_TYPE
The clockhourOfDay field type.
-
HOUR_OF_DAY_TYPE
private static final DateTimeFieldType HOUR_OF_DAY_TYPE
The hourOfDay field type.
-
MINUTE_OF_DAY_TYPE
private static final DateTimeFieldType MINUTE_OF_DAY_TYPE
The minuteOfDay field type.
-
MINUTE_OF_HOUR_TYPE
private static final DateTimeFieldType MINUTE_OF_HOUR_TYPE
The minuteOfHour field type.
-
SECOND_OF_DAY_TYPE
private static final DateTimeFieldType SECOND_OF_DAY_TYPE
The secondOfDay field type.
-
SECOND_OF_MINUTE_TYPE
private static final DateTimeFieldType SECOND_OF_MINUTE_TYPE
The secondOfMinute field type.
-
MILLIS_OF_DAY_TYPE
private static final DateTimeFieldType MILLIS_OF_DAY_TYPE
The millisOfDay field type.
-
MILLIS_OF_SECOND_TYPE
private static final DateTimeFieldType MILLIS_OF_SECOND_TYPE
The millisOfSecond field type.
-
iName
private final java.lang.String iName
The name of the field.
-
-
Method Detail
-
millisOfSecond
public static DateTimeFieldType millisOfSecond()
Get the millis of second field type.- Returns:
- the DateTimeFieldType constant
-
millisOfDay
public static DateTimeFieldType 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
public static DateTimeFieldType secondOfMinute()
Get the second of minute field type.- Returns:
- the DateTimeFieldType constant
-
secondOfDay
public static DateTimeFieldType 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
public static DateTimeFieldType minuteOfHour()
Get the minute of hour field type.- Returns:
- the DateTimeFieldType constant
-
minuteOfDay
public static DateTimeFieldType 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
public static DateTimeFieldType hourOfDay()
Get the hour of day (0-23) field type.- Returns:
- the DateTimeFieldType constant
-
clockhourOfDay
public static DateTimeFieldType clockhourOfDay()
Get the hour of day (offset to 1-24) field type.- Returns:
- the DateTimeFieldType constant
-
hourOfHalfday
public static DateTimeFieldType hourOfHalfday()
Get the hour of am/pm (0-11) field type.- Returns:
- the DateTimeFieldType constant
-
clockhourOfHalfday
public static DateTimeFieldType clockhourOfHalfday()
Get the hour of am/pm (offset to 1-12) field type.- Returns:
- the DateTimeFieldType constant
-
halfdayOfDay
public static DateTimeFieldType halfdayOfDay()
Get the AM(0) PM(1) field type.- Returns:
- the DateTimeFieldType constant
-
dayOfWeek
public static DateTimeFieldType dayOfWeek()
Get the day of week field type.- Returns:
- the DateTimeFieldType constant
-
dayOfMonth
public static DateTimeFieldType dayOfMonth()
Get the day of month field type.- Returns:
- the DateTimeFieldType constant
-
dayOfYear
public static DateTimeFieldType dayOfYear()
Get the day of year field type.- Returns:
- the DateTimeFieldType constant
-
weekOfWeekyear
public static DateTimeFieldType weekOfWeekyear()
Get the week of a week based year field type.- Returns:
- the DateTimeFieldType constant
-
weekyear
public static DateTimeFieldType weekyear()
Get the year of a week based year field type.- Returns:
- the DateTimeFieldType constant
-
weekyearOfCentury
public static DateTimeFieldType weekyearOfCentury()
Get the year of a week based year within a century field type.- Returns:
- the DateTimeFieldType constant
-
monthOfYear
public static DateTimeFieldType monthOfYear()
Get the month of year field type.- Returns:
- the DateTimeFieldType constant
-
year
public static DateTimeFieldType year()
Get the year field type.- Returns:
- the DateTimeFieldType constant
-
yearOfEra
public static DateTimeFieldType yearOfEra()
Get the year of era field type.- Returns:
- the DateTimeFieldType constant
-
yearOfCentury
public static DateTimeFieldType yearOfCentury()
Get the year of century field type.- Returns:
- the DateTimeFieldType constant
-
centuryOfEra
public static DateTimeFieldType centuryOfEra()
Get the century of era field type.- Returns:
- the DateTimeFieldType constant
-
era
public static DateTimeFieldType era()
Get the era field type.- Returns:
- the DateTimeFieldType constant
-
getName
public java.lang.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.
- Returns:
- field name
-
getDurationType
public abstract DurationFieldType getDurationType()
Get the duration unit of the field.- Returns:
- duration unit of the field, never null
-
getRangeDurationType
public abstract DurationFieldType getRangeDurationType()
Get the duration range of the field.- Returns:
- duration range of the field, null if unbounded
-
getField
public abstract DateTimeField getField(Chronology chronology)
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
public boolean isSupported(Chronology chronology)
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
public java.lang.String toString()
Get a suitable debug string.- Overrides:
toStringin classjava.lang.Object- Returns:
- debug string
-
-