org.joda.time
Class DurationFieldType
java.lang.Object
org.joda.time.DurationFieldType
- Serializable
public abstract class DurationFieldType
extends java.lang.Object
implements 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)
.
- Stephen Colebourne
- Brian S O'Neill
DurationFieldType
protected DurationFieldType(String name)
Constructor.
name
- the name to use, which by convention, are plural.
centuries
public static DurationFieldType centuries()
Get the centuries field type.
- the DateTimeFieldType constant
days
public static DurationFieldType days()
Get the days field type.
- the DateTimeFieldType constant
eras
public static DurationFieldType eras()
Get the eras field type.
- the DateTimeFieldType constant
getField
public abstract DurationField 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 are plural.
halfdays
public static DurationFieldType halfdays()
Get the halfdays field type.
- the DateTimeFieldType constant
hours
public static DurationFieldType hours()
Get the hours 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
millis
public static DurationFieldType millis()
Get the millis field type.
- the DateTimeFieldType constant
minutes
public static DurationFieldType minutes()
Get the minutes field type.
- the DateTimeFieldType constant
months
public static DurationFieldType months()
Get the months field type.
- the DateTimeFieldType constant
seconds
public static DurationFieldType seconds()
Get the seconds field type.
- the DateTimeFieldType constant
toString
public String toString()
Get a suitable debug string.
weeks
public static DurationFieldType weeks()
Get the weeks field type.
- the DateTimeFieldType constant
weekyears
public static DurationFieldType weekyears()
Get the weekyears field type.
- the DateTimeFieldType constant
years
public static DurationFieldType years()
Get the years field type.
- the DateTimeFieldType constant
Copyright (c) 2001-2006 - Joda.org