Package org.joda.time
Class DurationFieldType
- java.lang.Object
-
- org.joda.time.DurationFieldType
-
- All Implemented Interfaces:
java.io.Serializable
- Direct Known Subclasses:
DurationFieldType.StandardDurationFieldType
public abstract class DurationFieldType extends java.lang.Object implements java.io.SerializableIdentifies 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
DurationFieldTypeare singletons. They can be compared using==.If required, you can create your own field, for example a quarters. You must create a subclass of
DurationFieldTypethat defines the field type. This class returns the actual calculation engine fromgetField(Chronology).- Since:
- 1.0
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classDurationFieldType.StandardDurationFieldType
-
Field Summary
Fields Modifier and Type Field Description (package private) static byteCENTURIES(package private) static DurationFieldTypeCENTURIES_TYPEThe centuries field type.(package private) static byteDAYS(package private) static DurationFieldTypeDAYS_TYPEThe days field type.(package private) static byteERAS(package private) static DurationFieldTypeERAS_TYPEThe eras field type.(package private) static byteHALFDAYS(package private) static DurationFieldTypeHALFDAYS_TYPEThe halfdays field type.(package private) static byteHOURS(package private) static DurationFieldTypeHOURS_TYPEThe hours field type.private java.lang.StringiNameThe name of the field type.(package private) static byteMILLIS(package private) static DurationFieldTypeMILLIS_TYPEThe millis field type.(package private) static byteMINUTES(package private) static DurationFieldTypeMINUTES_TYPEThe minutes field type.(package private) static byteMONTHS(package private) static DurationFieldTypeMONTHS_TYPEThe months field type.(package private) static byteSECONDS(package private) static DurationFieldTypeSECONDS_TYPEThe seconds field type.private static longserialVersionUIDSerialization version(package private) static byteWEEKS(package private) static DurationFieldTypeWEEKS_TYPEThe weeks field type.(package private) static byteWEEKYEARS(package private) static DurationFieldTypeWEEKYEARS_TYPEThe weekyears field type.(package private) static byteYEARS(package private) static DurationFieldTypeYEARS_TYPEThe years field type.
-
Constructor Summary
Constructors Modifier Constructor Description protectedDurationFieldType(java.lang.String name)Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static DurationFieldTypecenturies()Get 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.java.lang.StringgetName()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.java.lang.StringtoString()Get a suitable debug string.static DurationFieldTypeweeks()Get the weeks field type.static DurationFieldTypeweekyears()Get the weekyears field type.static DurationFieldTypeyears()Get the years field type.
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
Serialization version- See Also:
- Constant Field Values
-
ERAS
static final byte ERAS
- See Also:
- Constant Field Values
-
CENTURIES
static final byte CENTURIES
- See Also:
- Constant Field Values
-
WEEKYEARS
static final byte WEEKYEARS
- See Also:
- Constant Field Values
-
YEARS
static final byte YEARS
- See Also:
- Constant Field Values
-
MONTHS
static final byte MONTHS
- See Also:
- Constant Field Values
-
WEEKS
static final byte WEEKS
- See Also:
- Constant Field Values
-
DAYS
static final byte DAYS
- See Also:
- Constant Field Values
-
HALFDAYS
static final byte HALFDAYS
- See Also:
- Constant Field Values
-
HOURS
static final byte HOURS
- See Also:
- Constant Field Values
-
MINUTES
static final byte MINUTES
- See Also:
- Constant Field Values
-
SECONDS
static final byte SECONDS
- See Also:
- Constant Field Values
-
MILLIS
static final byte MILLIS
- See Also:
- Constant Field Values
-
ERAS_TYPE
static final DurationFieldType ERAS_TYPE
The eras field type.
-
CENTURIES_TYPE
static final DurationFieldType CENTURIES_TYPE
The centuries field type.
-
WEEKYEARS_TYPE
static final DurationFieldType WEEKYEARS_TYPE
The weekyears field type.
-
YEARS_TYPE
static final DurationFieldType YEARS_TYPE
The years field type.
-
MONTHS_TYPE
static final DurationFieldType MONTHS_TYPE
The months field type.
-
WEEKS_TYPE
static final DurationFieldType WEEKS_TYPE
The weeks field type.
-
DAYS_TYPE
static final DurationFieldType DAYS_TYPE
The days field type.
-
HALFDAYS_TYPE
static final DurationFieldType HALFDAYS_TYPE
The halfdays field type.
-
HOURS_TYPE
static final DurationFieldType HOURS_TYPE
The hours field type.
-
MINUTES_TYPE
static final DurationFieldType MINUTES_TYPE
The minutes field type.
-
SECONDS_TYPE
static final DurationFieldType SECONDS_TYPE
The seconds field type.
-
MILLIS_TYPE
static final DurationFieldType MILLIS_TYPE
The millis field type.
-
iName
private final java.lang.String iName
The name of the field type.
-
-
Method Detail
-
millis
public static DurationFieldType millis()
Get the millis field type.- Returns:
- the DurationFieldType constant
-
seconds
public static DurationFieldType seconds()
Get the seconds field type.- Returns:
- the DurationFieldType constant
-
minutes
public static DurationFieldType minutes()
Get the minutes field type.- Returns:
- the DurationFieldType constant
-
hours
public static DurationFieldType hours()
Get the hours field type.- Returns:
- the DurationFieldType constant
-
halfdays
public static DurationFieldType halfdays()
Get the halfdays field type.- Returns:
- the DurationFieldType constant
-
days
public static DurationFieldType days()
Get the days field type.- Returns:
- the DurationFieldType constant
-
weeks
public static DurationFieldType weeks()
Get the weeks field type.- Returns:
- the DurationFieldType constant
-
weekyears
public static DurationFieldType weekyears()
Get the weekyears field type.- Returns:
- the DurationFieldType constant
-
months
public static DurationFieldType months()
Get the months field type.- Returns:
- the DurationFieldType constant
-
years
public static DurationFieldType years()
Get the years field type.- Returns:
- the DurationFieldType constant
-
centuries
public static DurationFieldType centuries()
Get the centuries field type.- Returns:
- the DurationFieldType constant
-
eras
public static DurationFieldType eras()
Get the eras field type.- Returns:
- the DurationFieldType constant
-
getName
public java.lang.String getName()
Get the name of the field. By convention, names are plural.- Returns:
- field name
-
getField
public abstract DurationField 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
-
-