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
Fields Modifier and Type Field Description (package private) static LongConverter
INSTANCE
Singleton instance.
-
Constructor Summary
Constructors Modifier Constructor Description protected
LongConverter()
Restricted constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description long
getDurationMillis(java.lang.Object object)
Gets the millisecond duration, which is the Long value.long
getInstantMillis(java.lang.Object object, Chronology chrono)
Gets the millisecond instant, which is the Long value.java.lang.Class<?>
getSupportedType()
Returns Long.class.-
Methods inherited from class org.joda.time.convert.AbstractConverter
getChronology, getChronology, 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.InstantConverter
getChronology, getChronology
-
Methods inherited from interface org.joda.time.convert.PartialConverter
getChronology, getChronology, getPartialValues, getPartialValues
-
-
-
-
Field Detail
-
INSTANCE
static final LongConverter INSTANCE
Singleton instance.
-
-
Method Detail
-
getInstantMillis
public long getInstantMillis(java.lang.Object object, Chronology chrono)
Gets the millisecond instant, which is the Long value.- Specified by:
getInstantMillis
in interfaceInstantConverter
- Overrides:
getInstantMillis
in 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:
java.lang.NullPointerException
- if the object is nulljava.lang.ClassCastException
- if the object is an invalid type
-
getDurationMillis
public long getDurationMillis(java.lang.Object object)
Gets the millisecond duration, which is the Long value.- Specified by:
getDurationMillis
in interfaceDurationConverter
- Parameters:
object
- the Long to convert, must not be null- Returns:
- the millisecond 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 Long.class.- Specified by:
getSupportedType
in interfaceConverter
- Returns:
- Long.class
-
-