Package org.joda.time.convert
Class NullConverter
- java.lang.Object
-
- org.joda.time.convert.AbstractConverter
-
- org.joda.time.convert.NullConverter
-
- All Implemented Interfaces:
Converter
,DurationConverter
,InstantConverter
,IntervalConverter
,PartialConverter
,PeriodConverter
class NullConverter extends AbstractConverter implements InstantConverter, PartialConverter, DurationConverter, PeriodConverter, IntervalConverter
NullConverter converts null to an instant, partial, duration, period or interval. Null means now for instant/partial, zero for duration/period and from now to now for interval.- Since:
- 1.0
-
-
Field Summary
Fields Modifier and Type Field Description (package private) static NullConverter
INSTANCE
Singleton instance.
-
Constructor Summary
Constructors Modifier Constructor Description protected
NullConverter()
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 zero.java.lang.Class<?>
getSupportedType()
Returns null.void
setInto(ReadWritableInterval writableInterval, java.lang.Object object, Chronology chrono)
Extracts interval endpoint values from an object of this converter's type, and sets them into the given ReadWritableInterval.void
setInto(ReadWritablePeriod duration, java.lang.Object object, Chronology chrono)
Sets the given ReadWritableDuration to zero milliseconds.-
Methods inherited from class org.joda.time.convert.AbstractConverter
getChronology, getChronology, getInstantMillis, 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, getInstantMillis
-
Methods inherited from interface org.joda.time.convert.IntervalConverter
isReadableInterval
-
Methods inherited from interface org.joda.time.convert.PartialConverter
getChronology, getChronology, getPartialValues, getPartialValues
-
Methods inherited from interface org.joda.time.convert.PeriodConverter
getPeriodType
-
-
-
-
Field Detail
-
INSTANCE
static final NullConverter INSTANCE
Singleton instance.
-
-
Method Detail
-
getDurationMillis
public long getDurationMillis(java.lang.Object object)
Gets the millisecond duration, which is zero.- Specified by:
getDurationMillis
in interfaceDurationConverter
- Parameters:
object
- the object to convert, which is null- Returns:
- the millisecond duration
-
setInto
public void setInto(ReadWritablePeriod duration, java.lang.Object object, Chronology chrono)
Sets the given ReadWritableDuration to zero milliseconds.- Specified by:
setInto
in interfacePeriodConverter
- Parameters:
duration
- duration to get modifiedobject
- the object to convert, which is nullchrono
- the chronology to use- Throws:
java.lang.NullPointerException
- if the duration is null
-
setInto
public void setInto(ReadWritableInterval writableInterval, java.lang.Object object, Chronology chrono)
Extracts interval endpoint values from an object of this converter's type, and sets them into the given ReadWritableInterval.- Specified by:
setInto
in interfaceIntervalConverter
- Parameters:
writableInterval
- interval to get modified, not nullobject
- the object to convert, which is nullchrono
- the chronology to use, may be null- Throws:
java.lang.NullPointerException
- if the interval is null
-
getSupportedType
public java.lang.Class<?> getSupportedType()
Returns null.- Specified by:
getSupportedType
in interfaceConverter
- Returns:
- null
-
-