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
FieldsModifier and TypeFieldDescription(package private) static final ReadableInstantConverterSingleton instance. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetChronology(Object object, Chronology chrono) Gets the chronology, which is taken from the ReadableInstant.getChronology(Object object, DateTimeZone zone) Gets the chronology, which is taken from the ReadableInstant.longgetInstantMillis(Object object, Chronology chrono) Extracts the millis from an object of this converter's type.Class<?> Returns ReadableInstant.class.Methods inherited from class org.joda.time.convert.AbstractConverter
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.PartialConverter
getPartialValues, getPartialValues
-
Field Details
-
INSTANCE
Singleton instance.
-
-
Constructor Details
-
ReadableInstantConverter
protected ReadableInstantConverter()Restricted constructor.
-
-
Method Details
-
getChronology
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
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
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:
NullPointerException- if the object is nullClassCastException- if the object is an invalid type
-
getSupportedType
Returns ReadableInstant.class.- Specified by:
getSupportedTypein interfaceConverter- Returns:
- ReadableInstant.class
-