Package org.joda.time.convert
Class ReadableDurationConverter
java.lang.Object
org.joda.time.convert.AbstractConverter
org.joda.time.convert.ReadableDurationConverter
- All Implemented Interfaces:
Converter,DurationConverter,PeriodConverter
class ReadableDurationConverter
extends AbstractConverter
implements DurationConverter, PeriodConverter
ReadableDurationConverter extracts milliseconds and chronology from a ReadableDuration.
- Since:
- 1.0
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final ReadableDurationConverterSingleton instance. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlonggetDurationMillis(Object object) Extracts the millis from an object of this converter's type.Class<?> Returns ReadableDuration.class.voidsetInto(ReadWritablePeriod writablePeriod, Object object, Chronology chrono) Extracts duration values from an object of this converter's type, and sets them into the given ReadWritableDuration.Methods inherited from class org.joda.time.convert.AbstractConverter
getChronology, getChronology, getInstantMillis, getPartialValues, getPartialValues, getPeriodType, isReadableInterval, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.joda.time.convert.PeriodConverter
getPeriodType
-
Field Details
-
INSTANCE
Singleton instance.
-
-
Constructor Details
-
ReadableDurationConverter
protected ReadableDurationConverter()Restricted constructor.
-
-
Method Details
-
getDurationMillis
Extracts the millis from an object of this converter's type.- Specified by:
getDurationMillisin interfaceDurationConverter- Parameters:
object- the object to convert, must not be null- Returns:
- the millisecond value
- Throws:
NullPointerException- if the object is nullClassCastException- if the object is an invalid typeIllegalArgumentException- if the object is invalid
-
setInto
Extracts duration values from an object of this converter's type, and sets them into the given ReadWritableDuration.- Specified by:
setIntoin interfacePeriodConverter- Parameters:
writablePeriod- period to get modifiedobject- the object to convert, must not be nullchrono- the chronology to use, must not be null- Throws:
NullPointerException- if the duration or object is nullClassCastException- if the object is an invalid typeIllegalArgumentException- if the object is invalid
-
getSupportedType
Returns ReadableDuration.class.- Specified by:
getSupportedTypein interfaceConverter- Returns:
- ReadableDuration.class
-