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
FieldsModifier and TypeFieldDescription(package private) static final NullConverterSingleton instance. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlonggetDurationMillis(Object object) Gets the millisecond duration, which is zero.Class<?> Returns null.voidsetInto(ReadWritableInterval writableInterval, Object object, Chronology chrono) Extracts interval endpoint values from an object of this converter's type, and sets them into the given ReadWritableInterval.voidsetInto(ReadWritablePeriod duration, 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, 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, getChronology, getInstantMillisMethods inherited from interface org.joda.time.convert.IntervalConverter
isReadableIntervalMethods inherited from interface org.joda.time.convert.PartialConverter
getChronology, getChronology, getPartialValues, getPartialValuesMethods inherited from interface org.joda.time.convert.PeriodConverter
getPeriodType
-
Field Details
-
INSTANCE
Singleton instance.
-
-
Constructor Details
-
NullConverter
protected NullConverter()Restricted constructor.
-
-
Method Details
-
getDurationMillis
Gets the millisecond duration, which is zero.- Specified by:
getDurationMillisin interfaceDurationConverter- Parameters:
object- the object to convert, which is null- Returns:
- the millisecond duration
-
setInto
Sets the given ReadWritableDuration to zero milliseconds.- Specified by:
setIntoin interfacePeriodConverter- Parameters:
duration- duration to get modifiedobject- the object to convert, which is nullchrono- the chronology to use- Throws:
NullPointerException- if the duration is null
-
setInto
Extracts interval endpoint values from an object of this converter's type, and sets them into the given ReadWritableInterval.- Specified by:
setIntoin interfaceIntervalConverter- Parameters:
writableInterval- interval to get modified, not nullobject- the object to convert, which is nullchrono- the chronology to use, may be null- Throws:
NullPointerException- if the interval is null
-
getSupportedType
Returns null.- Specified by:
getSupportedTypein interfaceConverter- Returns:
- null
-