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, wait
toString
public abstract DurationFieldType getFieldType()
public abstract PeriodType getPeriodType()
getPeriodType
in interface ReadablePeriod
public int size()
size
in interface ReadablePeriod
public DurationFieldType getFieldType(int index)
The only index supported by this period is zero which returns the field type of this class.
getFieldType
in interface ReadablePeriod
index
- 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 ReadablePeriod
index
- 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 ReadablePeriod
type
- the field type to query, null returns zeropublic boolean isSupported(DurationFieldType type)
isSupported
in interface ReadablePeriod
type
- the type to check, may be null which returns falsepublic Period toPeriod()
Period
object.
The period will use PeriodType.standard()
.toPeriod
in interface ReadablePeriod
Period
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 ReadablePeriod
public boolean equals(java.lang.Object period)
PeriodType
can return true.equals
in interface ReadablePeriod
equals
in class java.lang.Object
period
- a readable period to check againstpublic int hashCode()
hashCode
in interface ReadablePeriod
hashCode
in class java.lang.Object
public 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 - 2020 Adobe. All Rights Reserved