Package org.joda.time.convert
Class ReadablePeriodConverter
java.lang.Object
org.joda.time.convert.AbstractConverter
org.joda.time.convert.ReadablePeriodConverter
- All Implemented Interfaces:
Converter,PeriodConverter
ReadablePeriodConverter extracts milliseconds and chronology from a ReadablePeriod.
- Since:
- 1.0
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final ReadablePeriodConverterSingleton instance. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetPeriodType(Object object) Selects a suitable period type for the given object.Class<?> Returns ReadablePeriod class.voidsetInto(ReadWritablePeriod duration, Object object, Chronology chrono) Extracts duration values from an object of this converter's type, and sets them into the given ReadWritablePeriod.Methods inherited from class org.joda.time.convert.AbstractConverter
getChronology, getChronology, getInstantMillis, getPartialValues, getPartialValues, isReadableInterval, toString
-
Field Details
-
INSTANCE
Singleton instance.
-
-
Constructor Details
-
ReadablePeriodConverter
protected ReadablePeriodConverter()Restricted constructor.
-
-
Method Details
-
setInto
Extracts duration values from an object of this converter's type, and sets them into the given ReadWritablePeriod.- Specified by:
setIntoin interfacePeriodConverter- Parameters:
duration- duration to get modifiedobject- the object to convert, must not be nullchrono- the chronology to use- Throws:
NullPointerException- if the duration or object is nullClassCastException- if the object is an invalid typeIllegalArgumentException- if the object is invalid
-
getPeriodType
Selects a suitable period type for the given object.- Specified by:
getPeriodTypein interfacePeriodConverter- Overrides:
getPeriodTypein classAbstractConverter- Parameters:
object- the object to examine, must not be null- Returns:
- the period type from the readable duration
- Throws:
NullPointerException- if the object is nullClassCastException- if the object is an invalid type
-
getSupportedType
Returns ReadablePeriod class.- Specified by:
getSupportedTypein interfaceConverter- Returns:
- ReadablePeriod.class
-