public abstract class BaseSingleFieldPeriod extends java.lang.Object implements ReadablePeriod, java.lang.Comparable<BaseSingleFieldPeriod>, java.io.Serializable
This class should generally not be used directly by API users.
The ReadablePeriod interface should be used when different
kinds of period objects are to be referenced.
BaseSingleFieldPeriod subclasses may be mutable and not thread-safe.
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(BaseSingleFieldPeriod other)
Compares this period to another object of the same class.
|
boolean |
equals(java.lang.Object period)
Compares this object with the specified object for equality based on the
value of each field.
|
int |
get(DurationFieldType type)
Gets the value of a duration field represented by this period.
|
abstract DurationFieldType |
getFieldType()
Gets the single duration field type.
|
DurationFieldType |
getFieldType(int index)
Gets the field type at the specified index.
|
abstract PeriodType |
getPeriodType()
Gets the period type which matches the duration field type.
|
int |
getValue(int index)
Gets the value at the specified index.
|
int |
hashCode()
Gets a hash code for the period as defined by ReadablePeriod.
|
boolean |
isSupported(DurationFieldType type)
Checks whether the duration field specified is supported by this period.
|
int |
size()
Gets the number of fields that this period supports, which is one.
|
MutablePeriod |
toMutablePeriod()
Get this object as a
MutablePeriod. |
Period |
toPeriod()
Get this period as an immutable
Period object. |
getClass, notify, notifyAll, toString, wait, wait, waittoStringpublic abstract DurationFieldType getFieldType()
public abstract PeriodType getPeriodType()
getPeriodType in interface ReadablePeriodpublic int size()
size in interface ReadablePeriodpublic DurationFieldType getFieldType(int index)
The only index supported by this period is zero which returns the field type of this class.
getFieldType in interface ReadablePeriodindex - the index to retrieve, which must be zerojava.lang.IndexOutOfBoundsException - if the index is invalidpublic int getValue(int index)
The only index supported by this period is zero.
getValue in interface ReadablePeriodindex - the index to retrieve, which must be zerojava.lang.IndexOutOfBoundsException - if the index is invalidpublic int get(DurationFieldType type)
If the field type specified does not match the type used by this class then zero is returned.
get in interface ReadablePeriodtype - the field type to query, null returns zeropublic boolean isSupported(DurationFieldType type)
isSupported in interface ReadablePeriodtype - the type to check, may be null which returns falsepublic Period toPeriod()
Period object.
The period will use PeriodType.standard().toPeriod in interface ReadablePeriodPeriod representing the same number of dayspublic MutablePeriod toMutablePeriod()
MutablePeriod.
This will always return a new MutablePeriod with the same fields.
The period will use PeriodType.standard().
toMutablePeriod in interface ReadablePeriodpublic boolean equals(java.lang.Object period)
PeriodType can return true.equals in interface ReadablePeriodequals in class java.lang.Objectperiod - a readable period to check againstpublic int hashCode()
hashCode in interface ReadablePeriodhashCode in class java.lang.Objectpublic int compareTo(BaseSingleFieldPeriod other)
compareTo in interface java.lang.Comparable<BaseSingleFieldPeriod>other - the other period, must not be nulljava.lang.NullPointerException - if the other period is nulljava.lang.ClassCastException - if the other period is of a different typeCopyright © 2010 - 2023 Adobe. All Rights Reserved