Class ReadableInstantConverter

java.lang.Object
org.joda.time.convert.AbstractConverter
org.joda.time.convert.ReadableInstantConverter
All Implemented Interfaces:
Converter, InstantConverter, PartialConverter

class ReadableInstantConverter extends AbstractConverter implements InstantConverter, PartialConverter
ReadableInstantConverter extracts milliseconds and chronology from a ReadableInstant.
Since:
1.0
  • Field Details

  • Constructor Details

    • ReadableInstantConverter

      protected ReadableInstantConverter()
      Restricted constructor.
  • Method Details

    • getChronology

      public Chronology getChronology(Object object, DateTimeZone zone)
      Gets the chronology, which is taken from the ReadableInstant. If the chronology on the instant is null, the ISOChronology in the specified time zone is used. If the chronology on the instant is not in the specified zone, it is adapted.
      Specified by:
      getChronology in interface InstantConverter
      Specified by:
      getChronology in interface PartialConverter
      Overrides:
      getChronology in class AbstractConverter
      Parameters:
      object - the ReadableInstant to convert, must not be null
      zone - the specified zone to use, null means default zone
      Returns:
      the chronology, never null
    • getChronology

      public Chronology getChronology(Object object, Chronology chrono)
      Gets the chronology, which is taken from the ReadableInstant.

      If the passed in chronology is non-null, it is used. Otherwise the chronology from the instant is used.

      Specified by:
      getChronology in interface InstantConverter
      Specified by:
      getChronology in interface PartialConverter
      Overrides:
      getChronology in class AbstractConverter
      Parameters:
      object - the ReadableInstant to convert, must not be null
      chrono - the chronology to use, null means use that from object
      Returns:
      the chronology, never null
    • getInstantMillis

      public long getInstantMillis(Object object, Chronology chrono)
      Extracts the millis from an object of this converter's type.
      Specified by:
      getInstantMillis in interface InstantConverter
      Overrides:
      getInstantMillis in class AbstractConverter
      Parameters:
      object - the ReadableInstant to convert, must not be null
      chrono - the non-null result of getChronology
      Returns:
      the millisecond value
      Throws:
      NullPointerException - if the object is null
      ClassCastException - if the object is an invalid type
    • getSupportedType

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