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.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 fromgetField(Chronology)
.- Since:
- 1.0
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
DurationFieldType.StandardDurationFieldType
-
Field Summary
Fields Modifier and Type Field Description (package private) static byte
CENTURIES
(package private) static DurationFieldType
CENTURIES_TYPE
The centuries field type.(package private) static byte
DAYS
(package private) static DurationFieldType
DAYS_TYPE
The days field type.(package private) static byte
ERAS
(package private) static DurationFieldType
ERAS_TYPE
The eras field type.(package private) static byte
HALFDAYS
(package private) static DurationFieldType
HALFDAYS_TYPE
The halfdays field type.(package private) static byte
HOURS
(package private) static DurationFieldType
HOURS_TYPE
The hours field type.private java.lang.String
iName
The name of the field type.(package private) static byte
MILLIS
(package private) static DurationFieldType
MILLIS_TYPE
The millis field type.(package private) static byte
MINUTES
(package private) static DurationFieldType
MINUTES_TYPE
The minutes field type.(package private) static byte
MONTHS
(package private) static DurationFieldType
MONTHS_TYPE
The months field type.(package private) static byte
SECONDS
(package private) static DurationFieldType
SECONDS_TYPE
The seconds field type.private static long
serialVersionUID
Serialization version(package private) static byte
WEEKS
(package private) static DurationFieldType
WEEKS_TYPE
The weeks field type.(package private) static byte
WEEKYEARS
(package private) static DurationFieldType
WEEKYEARS_TYPE
The weekyears field type.(package private) static byte
YEARS
(package private) static DurationFieldType
YEARS_TYPE
The years field type.
-
Constructor Summary
Constructors Modifier Constructor Description protected
DurationFieldType(java.lang.String name)
Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static DurationFieldType
centuries()
Get the centuries field type.static DurationFieldType
days()
Get the days field type.static DurationFieldType
eras()
Get the eras field type.abstract DurationField
getField(Chronology chronology)
Gets a suitable field for this type from the given Chronology.java.lang.String
getName()
Get the name of the field.static DurationFieldType
halfdays()
Get the halfdays field type.static DurationFieldType
hours()
Get the hours field type.boolean
isSupported(Chronology chronology)
Checks whether this field supported in the given Chronology.static DurationFieldType
millis()
Get the millis field type.static DurationFieldType
minutes()
Get the minutes field type.static DurationFieldType
months()
Get the months field type.static DurationFieldType
seconds()
Get the seconds field type.java.lang.String
toString()
Get a suitable debug string.static DurationFieldType
weeks()
Get the weeks field type.static DurationFieldType
weekyears()
Get the weekyears field type.static DurationFieldType
years()
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:
toString
in classjava.lang.Object
- Returns:
- debug string
-
-