Package org.joda.time
Class DurationFieldType
java.lang.Object
org.joda.time.DurationFieldType
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
DurationFieldType.StandardDurationFieldType
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
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static class -
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final byte(package private) static final DurationFieldTypeThe centuries field type.(package private) static final byte(package private) static final DurationFieldTypeThe days field type.(package private) static final byte(package private) static final DurationFieldTypeThe eras field type.(package private) static final byte(package private) static final DurationFieldTypeThe halfdays field type.(package private) static final byte(package private) static final DurationFieldTypeThe hours field type.private final StringThe name of the field type.(package private) static final byte(package private) static final DurationFieldTypeThe millis field type.(package private) static final byte(package private) static final DurationFieldTypeThe minutes field type.(package private) static final byte(package private) static final DurationFieldTypeThe months field type.(package private) static final byte(package private) static final DurationFieldTypeThe seconds field type.private static final longSerialization version(package private) static final byte(package private) static final DurationFieldTypeThe weeks field type.(package private) static final byte(package private) static final DurationFieldTypeThe weekyears field type.(package private) static final byte(package private) static final DurationFieldTypeThe years field type. -
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.
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDSerialization version- See Also:
-
ERAS
static final byte ERAS- See Also:
-
CENTURIES
static final byte CENTURIES- See Also:
-
WEEKYEARS
static final byte WEEKYEARS- See Also:
-
YEARS
static final byte YEARS- See Also:
-
MONTHS
static final byte MONTHS- See Also:
-
WEEKS
static final byte WEEKS- See Also:
-
DAYS
static final byte DAYS- See Also:
-
HALFDAYS
static final byte HALFDAYS- See Also:
-
HOURS
static final byte HOURS- See Also:
-
MINUTES
static final byte MINUTES- See Also:
-
SECONDS
static final byte SECONDS- See Also:
-
MILLIS
static final byte MILLIS- See Also:
-
ERAS_TYPE
The eras field type. -
CENTURIES_TYPE
The centuries field type. -
WEEKYEARS_TYPE
The weekyears field type. -
YEARS_TYPE
The years field type. -
MONTHS_TYPE
The months field type. -
WEEKS_TYPE
The weeks field type. -
DAYS_TYPE
The days field type. -
HALFDAYS_TYPE
The halfdays field type. -
HOURS_TYPE
The hours field type. -
MINUTES_TYPE
The minutes field type. -
SECONDS_TYPE
The seconds field type. -
MILLIS_TYPE
The millis field type. -
iName
The name of the 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.
-