| java.lang.Object org.joda.time.PeriodType
PeriodType | public class PeriodType implements Serializable(Code) | | Controls a period implementation by specifying which duration fields are to be used.
The following implementations are provided:
- Standard - years, months, weeks, days, hours, minutes, seconds, millis
- YearMonthDayTime - years, months, days, hours, minutes, seconds, millis
- YearMonthDay - years, months, days
- YearWeekDayTime - years, weeks, days, hours, minutes, seconds, millis
- YearWeekDay - years, weeks, days
- YearDayTime - years, days, hours, minutes, seconds, millis
- YearDay - years, days, hours
- DayTime - days, hours, minutes, seconds, millis
- Time - hours, minutes, seconds, millis
- plus one for each single type
PeriodType is thread-safe and immutable, and all subclasses must be as well.
author: Brian S O'Neill author: Stephen Colebourne since: 1.0 |
DAY_INDEX | static int DAY_INDEX(Code) | | |
HOUR_INDEX | static int HOUR_INDEX(Code) | | |
MILLI_INDEX | static int MILLI_INDEX(Code) | | |
MINUTE_INDEX | static int MINUTE_INDEX(Code) | | |
MONTH_INDEX | static int MONTH_INDEX(Code) | | |
SECOND_INDEX | static int SECOND_INDEX(Code) | | |
WEEK_INDEX | static int WEEK_INDEX(Code) | | |
YEAR_INDEX | static int YEAR_INDEX(Code) | | |
PeriodType | protected PeriodType(String name, DurationFieldType[] types, int[] indices)(Code) | | Constructor.
Parameters: name - the name Parameters: types - the types Parameters: indices - the indices |
addIndexedField | boolean addIndexedField(ReadablePeriod period, int index, int[] values, int valueToAdd)(Code) | | Adds to the indexed field part of the period.
Parameters: period - the period to query Parameters: index - the index to use Parameters: values - the array to populate Parameters: valueToAdd - the value to add true if the array is updated throws: UnsupportedOperationException - if not supported |
dayTime | public static PeriodType dayTime()(Code) | | Gets a type that defines all standard fields from days downwards.
- days
- hours
- minutes
- seconds
- milliseconds
the period type |
days | public static PeriodType days()(Code) | | Gets a type that defines just the days field.
the period type |
equals | public boolean equals(Object obj)(Code) | | Compares this type to another object.
To be equal, the object must be a PeriodType with the same set of fields.
Parameters: obj - the object to compare to true if equal |
forFields | public static synchronized PeriodType forFields(DurationFieldType[] types)(Code) | | Gets a period type that contains the duration types of the array.
Only the 8 standard duration field types are supported.
Parameters: types - the types to include in the array. the period type since: 1.1 |
getIndexedField | int getIndexedField(ReadablePeriod period, int index)(Code) | | Gets the indexed field part of the period.
Parameters: period - the period to query Parameters: index - the index to use the value of the field, zero if unsupported |
getName | public String getName()(Code) | | Gets the name of the period type.
the name |
hashCode | public int hashCode()(Code) | | Returns a hashcode based on the field types.
a suitable hashcode |
hours | public static PeriodType hours()(Code) | | Gets a type that defines just the hours field.
the period type |
indexOf | public int indexOf(DurationFieldType type)(Code) | | Gets the index of the field in this period.
Parameters: type - the type to check, may be null which returns -1 the index of -1 if not supported |
isSupported | public boolean isSupported(DurationFieldType type)(Code) | | Checks whether the field specified is supported by this period.
Parameters: type - the type to check, may be null which returns false true if the field is supported |
millis | public static PeriodType millis()(Code) | | Gets a type that defines just the millis field.
the period type |
minutes | public static PeriodType minutes()(Code) | | Gets a type that defines just the minutes field.
the period type |
months | public static PeriodType months()(Code) | | Gets a type that defines just the months field.
the period type |
seconds | public static PeriodType seconds()(Code) | | Gets a type that defines just the seconds field.
the period type |
setIndexedField | boolean setIndexedField(ReadablePeriod period, int index, int[] values, int newValue)(Code) | | Sets the indexed field part of the period.
Parameters: period - the period to query Parameters: index - the index to use Parameters: values - the array to populate Parameters: newValue - the value to set throws: UnsupportedOperationException - if not supported |
size | public int size()(Code) | | Gets the number of fields in the period type.
the number of fields |
standard | public static PeriodType standard()(Code) | | Gets a type that defines all standard fields.
- years
- months
- weeks
- days
- hours
- minutes
- seconds
- milliseconds
the period type |
time | public static PeriodType time()(Code) | | Gets a type that defines all standard time fields.
- hours
- minutes
- seconds
- milliseconds
the period type |
toString | public String toString()(Code) | | Gets a debugging to string.
a string |
weeks | public static PeriodType weeks()(Code) | | Gets a type that defines just the weeks field.
the period type |
withDaysRemoved | public PeriodType withDaysRemoved()(Code) | | Returns a version of this PeriodType instance that does not support days.
a new period type that supports the original set of fields except days |
withHoursRemoved | public PeriodType withHoursRemoved()(Code) | | Returns a version of this PeriodType instance that does not support hours.
a new period type that supports the original set of fields except hours |
withMillisRemoved | public PeriodType withMillisRemoved()(Code) | | Returns a version of this PeriodType instance that does not support milliseconds.
a new period type that supports the original set of fields except milliseconds |
withMinutesRemoved | public PeriodType withMinutesRemoved()(Code) | | Returns a version of this PeriodType instance that does not support minutes.
a new period type that supports the original set of fields except minutes |
withMonthsRemoved | public PeriodType withMonthsRemoved()(Code) | | Returns a version of this PeriodType instance that does not support months.
a new period type that supports the original set of fields except months |
withSecondsRemoved | public PeriodType withSecondsRemoved()(Code) | | Returns a version of this PeriodType instance that does not support seconds.
a new period type that supports the original set of fields except seconds |
withWeeksRemoved | public PeriodType withWeeksRemoved()(Code) | | Returns a version of this PeriodType instance that does not support weeks.
a new period type that supports the original set of fields except weeks |
withYearsRemoved | public PeriodType withYearsRemoved()(Code) | | Returns a version of this PeriodType instance that does not support years.
a new period type that supports the original set of fields except years |
yearDay | public static PeriodType yearDay()(Code) | | Gets a type that defines the year and day fields.
the period type since: 1.1 |
yearDayTime | public static PeriodType yearDayTime()(Code) | | Gets a type that defines all standard fields except months and weeks.
- years
- days
- hours
- minutes
- seconds
- milliseconds
the period type |
yearMonthDay | public static PeriodType yearMonthDay()(Code) | | Gets a type that defines the year, month and day fields.
the period type since: 1.1 |
yearMonthDayTime | public static PeriodType yearMonthDayTime()(Code) | | Gets a type that defines all standard fields except weeks.
- years
- months
- days
- hours
- minutes
- seconds
- milliseconds
the period type |
yearWeekDay | public static PeriodType yearWeekDay()(Code) | | Gets a type that defines year, week and day fields.
the period type since: 1.1 |
yearWeekDayTime | public static PeriodType yearWeekDayTime()(Code) | | Gets a type that defines all standard fields except months.
- years
- weeks
- days
- hours
- minutes
- seconds
- milliseconds
the period type |
years | public static PeriodType years()(Code) | | Gets a type that defines just the years field.
the period type |
|
|