Package org.joda.time
Class DurationFieldType
java.lang.Object
org.joda.time.DurationFieldType
- All Implemented Interfaces:
Serializable
Identifies a duration field, such as years or minutes, in a chronology-neutral way.
A duration field type defines the type of the field, such as hours.
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.
Instances of DurationFieldType are singletons.
They can be compared using ==.
If required, you can create your own field, for example a quarters.
You must create a subclass of DurationFieldType that defines the field type.
This class returns the actual calculation engine from getField(Chronology).
- Since:
- 1.0
- Author:
- Stephen Colebourne, Brian S O'Neill
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic DurationFieldTypeGet the centuries field type.static DurationFieldTypedays()Get the days field type.static DurationFieldTypeeras()Get the eras field type.abstract DurationFieldgetField(Chronology chronology) Gets a suitable field for this type from the given Chronology.getName()Get the name of the field.static DurationFieldTypehalfdays()Get the halfdays field type.static DurationFieldTypehours()Get the hours field type.booleanisSupported(Chronology chronology) Checks whether this field supported in the given Chronology.static DurationFieldTypemillis()Get the millis field type.static DurationFieldTypeminutes()Get the minutes field type.static DurationFieldTypemonths()Get the months field type.static DurationFieldTypeseconds()Get the seconds field type.toString()Get a suitable debug string.static DurationFieldTypeweeks()Get the weeks field type.static DurationFieldTypeGet the weekyears field type.static DurationFieldTypeyears()Get the years field type.
-
Constructor Details
-
DurationFieldType
Constructor.- Parameters:
name- the name to use, which by convention, are plural.
-
-
Method Details
-
millis
Get the millis field type.- Returns:
- the DurationFieldType constant
-
seconds
Get the seconds field type.- Returns:
- the DurationFieldType constant
-
minutes
Get the minutes field type.- Returns:
- the DurationFieldType constant
-
hours
Get the hours field type.- Returns:
- the DurationFieldType constant
-
halfdays
Get the halfdays field type.- Returns:
- the DurationFieldType constant
-
days
Get the days field type.- Returns:
- the DurationFieldType constant
-
weeks
Get the weeks field type.- Returns:
- the DurationFieldType constant
-
weekyears
Get the weekyears field type.- Returns:
- the DurationFieldType constant
-
months
Get the months field type.- Returns:
- the DurationFieldType constant
-
years
Get the years field type.- Returns:
- the DurationFieldType constant
-
centuries
Get the centuries field type.- Returns:
- the DurationFieldType constant
-
eras
Get the eras field type.- Returns:
- the DurationFieldType constant
-
getName
Get the name of the field. By convention, names are plural.- Returns:
- field name
-
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.
-