Class NullConverter

java.lang.Object
org.joda.time.convert.AbstractConverter
org.joda.time.convert.NullConverter
All Implemented Interfaces:
Converter, DurationConverter, InstantConverter, IntervalConverter, PartialConverter, PeriodConverter

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 Details

    • INSTANCE

      static final NullConverter INSTANCE
      Singleton instance.
  • Constructor Details

    • NullConverter

      protected NullConverter()
      Restricted constructor.
  • Method Details

    • getDurationMillis

      public long getDurationMillis(Object object)
      Gets the millisecond duration, which is zero.
      Specified by:
      getDurationMillis in interface DurationConverter
      Parameters:
      object - the object to convert, which is null
      Returns:
      the millisecond duration
    • setInto

      public void setInto(ReadWritablePeriod duration, Object object, Chronology chrono)
      Sets the given ReadWritableDuration to zero milliseconds.
      Specified by:
      setInto in interface PeriodConverter
      Parameters:
      duration - duration to get modified
      object - the object to convert, which is null
      chrono - the chronology to use
      Throws:
      NullPointerException - if the duration is null
    • setInto

      public void setInto(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.
      Specified by:
      setInto in interface IntervalConverter
      Parameters:
      writableInterval - interval to get modified, not null
      object - the object to convert, which is null
      chrono - the chronology to use, may be null
      Throws:
      NullPointerException - if the interval is null
    • getSupportedType

      public Class<?> getSupportedType()
      Returns null.
      Specified by:
      getSupportedType in interface Converter
      Returns:
      null