Package org.joda.time.convert
Class LongConverter
java.lang.Object
org.joda.time.convert.AbstractConverter
org.joda.time.convert.LongConverter
- All Implemented Interfaces:
Converter,DurationConverter,InstantConverter,PartialConverter
class LongConverter
extends AbstractConverter
implements InstantConverter, PartialConverter, DurationConverter
LongConverter converts a Long to an instant, partial or duration.
The Long value represents milliseconds in the ISO chronology.
- Since:
- 1.0
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final LongConverterSingleton instance. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlonggetDurationMillis(Object object) Gets the millisecond duration, which is the Long value.longgetInstantMillis(Object object, Chronology chrono) Gets the millisecond instant, which is the Long value.Class<?> Returns Long.class.Methods inherited from class org.joda.time.convert.AbstractConverter
getChronology, getChronology, 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.InstantConverter
getChronology, getChronologyMethods inherited from interface org.joda.time.convert.PartialConverter
getChronology, getChronology, getPartialValues, getPartialValues
-
Field Details
-
INSTANCE
Singleton instance.
-
-
Constructor Details
-
LongConverter
protected LongConverter()Restricted constructor.
-
-
Method Details
-
getInstantMillis
Gets the millisecond instant, which is the Long value.- Specified by:
getInstantMillisin interfaceInstantConverter- Overrides:
getInstantMillisin classAbstractConverter- Parameters:
object- the Long to convert, must not be nullchrono- the chronology to use, which is always non-null- Returns:
- the millisecond value
- Throws:
NullPointerException- if the object is nullClassCastException- if the object is an invalid type
-
getDurationMillis
Gets the millisecond duration, which is the Long value.- Specified by:
getDurationMillisin interfaceDurationConverter- Parameters:
object- the Long to convert, must not be null- Returns:
- the millisecond duration
- Throws:
NullPointerException- if the object is nullClassCastException- if the object is an invalid type
-
getSupportedType
Returns Long.class.- Specified by:
getSupportedTypein interfaceConverter- Returns:
- Long.class
-