Package org.joda.time.convert
Class ReadableInstantConverter
- java.lang.Object
-
- org.joda.time.convert.AbstractConverter
-
- org.joda.time.convert.ReadableInstantConverter
-
- All Implemented Interfaces:
Converter,InstantConverter,PartialConverter
class ReadableInstantConverter extends AbstractConverter implements InstantConverter, PartialConverter
ReadableInstantConverter extracts milliseconds and chronology from a ReadableInstant.- Since:
- 1.0
-
-
Field Summary
Fields Modifier and Type Field Description (package private) static ReadableInstantConverterINSTANCESingleton instance.
-
Constructor Summary
Constructors Modifier Constructor Description protectedReadableInstantConverter()Restricted constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ChronologygetChronology(java.lang.Object object, Chronology chrono)Gets the chronology, which is taken from the ReadableInstant.ChronologygetChronology(java.lang.Object object, DateTimeZone zone)Gets the chronology, which is taken from the ReadableInstant.longgetInstantMillis(java.lang.Object object, Chronology chrono)Extracts the millis from an object of this converter's type.java.lang.Class<?>getSupportedType()Returns ReadableInstant.class.-
Methods inherited from class org.joda.time.convert.AbstractConverter
getPartialValues, getPartialValues, getPeriodType, isReadableInterval, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.joda.time.convert.PartialConverter
getPartialValues, getPartialValues
-
-
-
-
Field Detail
-
INSTANCE
static final ReadableInstantConverter INSTANCE
Singleton instance.
-
-
Method Detail
-
getChronology
public Chronology getChronology(java.lang.Object object, DateTimeZone zone)
Gets the chronology, which is taken from the ReadableInstant. If the chronology on the instant is null, the ISOChronology in the specified time zone is used. If the chronology on the instant is not in the specified zone, it is adapted.- Specified by:
getChronologyin interfaceInstantConverter- Specified by:
getChronologyin interfacePartialConverter- Overrides:
getChronologyin classAbstractConverter- Parameters:
object- the ReadableInstant to convert, must not be nullzone- the specified zone to use, null means default zone- Returns:
- the chronology, never null
-
getChronology
public Chronology getChronology(java.lang.Object object, Chronology chrono)
Gets the chronology, which is taken from the ReadableInstant.If the passed in chronology is non-null, it is used. Otherwise the chronology from the instant is used.
- Specified by:
getChronologyin interfaceInstantConverter- Specified by:
getChronologyin interfacePartialConverter- Overrides:
getChronologyin classAbstractConverter- Parameters:
object- the ReadableInstant to convert, must not be nullchrono- the chronology to use, null means use that from object- Returns:
- the chronology, never null
-
getInstantMillis
public long getInstantMillis(java.lang.Object object, Chronology chrono)Extracts the millis from an object of this converter's type.- Specified by:
getInstantMillisin interfaceInstantConverter- Overrides:
getInstantMillisin classAbstractConverter- Parameters:
object- the ReadableInstant to convert, must not be nullchrono- the non-null result of getChronology- Returns:
- the millisecond value
- 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 ReadableInstant.class.- Specified by:
getSupportedTypein interfaceConverter- Returns:
- ReadableInstant.class
-
-