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
class ReadablePeriodConverter extends AbstractConverter implements PeriodConverter
ReadablePeriodConverter extracts milliseconds and chronology from a ReadablePeriod.- Since:
- 1.0
-
-
Field Summary
Fields Modifier and Type Field Description (package private) static ReadablePeriodConverter
INSTANCE
Singleton instance.
-
Constructor Summary
Constructors Modifier Constructor Description protected
ReadablePeriodConverter()
Restricted constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PeriodType
getPeriodType(java.lang.Object object)
Selects a suitable period type for the given object.java.lang.Class<?>
getSupportedType()
Returns ReadablePeriod class.void
setInto(ReadWritablePeriod duration, java.lang.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 Detail
-
INSTANCE
static final ReadablePeriodConverter INSTANCE
Singleton instance.
-
-
Method Detail
-
setInto
public void setInto(ReadWritablePeriod duration, java.lang.Object object, Chronology chrono)
Extracts duration values from an object of this converter's type, and sets them into the given ReadWritablePeriod.- Specified by:
setInto
in interfacePeriodConverter
- Parameters:
duration
- duration to get modifiedobject
- the object to convert, must not be nullchrono
- the chronology to use- Throws:
java.lang.NullPointerException
- if the duration or object is nulljava.lang.ClassCastException
- if the object is an invalid typejava.lang.IllegalArgumentException
- if the object is invalid
-
getPeriodType
public PeriodType getPeriodType(java.lang.Object object)
Selects a suitable period type for the given object.- Specified by:
getPeriodType
in interfacePeriodConverter
- Overrides:
getPeriodType
in classAbstractConverter
- Parameters:
object
- the object to examine, must not be null- Returns:
- the period type from the readable duration
- Throws:
java.lang.NullPointerException
- if the object is nulljava.lang.ClassCastException
- if the object is an invalid type
-
getSupportedType
public java.lang.Class<?> getSupportedType()
Returns ReadablePeriod class.- Specified by:
getSupportedType
in interfaceConverter
- Returns:
- ReadablePeriod.class
-
-