|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.joda.time.PeriodType
public class PeriodType
Controls a period implementation by specifying which duration fields are to be used.
The following implementations are provided:
PeriodType is thread-safe and immutable, and all subclasses must be as well.
Constructor Summary | |
---|---|
protected |
PeriodType(String name,
DurationFieldType[] types,
int[] indices)
Constructor. |
Method Summary | |
---|---|
static PeriodType |
days()
Gets a type that defines just the days field. |
static PeriodType |
dayTime()
Gets a type that defines all standard fields from days downwards. |
boolean |
equals(Object obj)
Compares this type to another object. |
static PeriodType |
forFields(DurationFieldType[] types)
Gets a period type that contains the duration types of the array. |
DurationFieldType |
getFieldType(int index)
Gets the field type by index. |
String |
getName()
Gets the name of the period type. |
int |
hashCode()
Returns a hashcode based on the field types. |
static PeriodType |
hours()
Gets a type that defines just the hours field. |
int |
indexOf(DurationFieldType type)
Gets the index of the field in this period. |
boolean |
isSupported(DurationFieldType type)
Checks whether the field specified is supported by this period. |
static PeriodType |
millis()
Gets a type that defines just the millis field. |
static PeriodType |
minutes()
Gets a type that defines just the minutes field. |
static PeriodType |
months()
Gets a type that defines just the months field. |
static PeriodType |
seconds()
Gets a type that defines just the seconds field. |
int |
size()
Gets the number of fields in the period type. |
static PeriodType |
standard()
Gets a type that defines all standard fields. |
static PeriodType |
time()
Gets a type that defines all standard time fields. |
String |
toString()
Gets a debugging to string. |
static PeriodType |
weeks()
Gets a type that defines just the weeks field. |
PeriodType |
withDaysRemoved()
Returns a version of this PeriodType instance that does not support days. |
PeriodType |
withHoursRemoved()
Returns a version of this PeriodType instance that does not support hours. |
PeriodType |
withMillisRemoved()
Returns a version of this PeriodType instance that does not support milliseconds. |
PeriodType |
withMinutesRemoved()
Returns a version of this PeriodType instance that does not support minutes. |
PeriodType |
withMonthsRemoved()
Returns a version of this PeriodType instance that does not support months. |
PeriodType |
withSecondsRemoved()
Returns a version of this PeriodType instance that does not support seconds. |
PeriodType |
withWeeksRemoved()
Returns a version of this PeriodType instance that does not support weeks. |
PeriodType |
withYearsRemoved()
Returns a version of this PeriodType instance that does not support years. |
static PeriodType |
yearDay()
Gets a type that defines the year and day fields. |
static PeriodType |
yearDayTime()
Gets a type that defines all standard fields except months and weeks. |
static PeriodType |
yearMonthDay()
Gets a type that defines the year, month and day fields. |
static PeriodType |
yearMonthDayTime()
Gets a type that defines all standard fields except weeks. |
static PeriodType |
years()
Gets a type that defines just the years field. |
static PeriodType |
yearWeekDay()
Gets a type that defines year, week and day fields. |
static PeriodType |
yearWeekDayTime()
Gets a type that defines all standard fields except months. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
protected PeriodType(String name, DurationFieldType[] types, int[] indices)
name
- the nametypes
- the typesindices
- the indicesMethod Detail |
---|
public static PeriodType standard()
public static PeriodType yearMonthDayTime()
public static PeriodType yearMonthDay()
public static PeriodType yearWeekDayTime()
public static PeriodType yearWeekDay()
public static PeriodType yearDayTime()
public static PeriodType yearDay()
public static PeriodType dayTime()
public static PeriodType time()
public static PeriodType years()
public static PeriodType months()
public static PeriodType weeks()
public static PeriodType days()
public static PeriodType hours()
public static PeriodType minutes()
public static PeriodType seconds()
public static PeriodType millis()
public static PeriodType forFields(DurationFieldType[] types)
Only the 8 standard duration field types are supported.
types
- the types to include in the array.
public String getName()
public int size()
public DurationFieldType getFieldType(int index)
index
- the index to retrieve
IndexOutOfBoundsException
- if the index is invalidpublic boolean isSupported(DurationFieldType type)
type
- the type to check, may be null which returns false
public int indexOf(DurationFieldType type)
type
- the type to check, may be null which returns -1
public String toString()
toString
in class Object
public PeriodType withYearsRemoved()
public PeriodType withMonthsRemoved()
public PeriodType withWeeksRemoved()
public PeriodType withDaysRemoved()
public PeriodType withHoursRemoved()
public PeriodType withMinutesRemoved()
public PeriodType withSecondsRemoved()
public PeriodType withMillisRemoved()
public boolean equals(Object obj)
equals
in class Object
obj
- the object to compare to
public int hashCode()
hashCode
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |