Class ReadablePartialConverter

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

class ReadablePartialConverter extends AbstractConverter implements PartialConverter
ReadablePartialConverter extracts partial fields and chronology from a ReadablePartial.
Since:
1.0
  • Field Details

  • Constructor Details

    • ReadablePartialConverter

      protected ReadablePartialConverter()
      Restricted constructor.
  • Method Details

    • getChronology

      public Chronology getChronology(Object object, DateTimeZone zone)
      Gets the chronology, which is taken from the ReadablePartial.
      Specified by:
      getChronology in interface PartialConverter
      Overrides:
      getChronology in class AbstractConverter
      Parameters:
      object - the ReadablePartial 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 PartialConverter
      Overrides:
      getChronology in class AbstractConverter
      Parameters:
      object - the ReadablePartial to convert, must not be null
      chrono - the chronology to use, null means use that from object
      Returns:
      the chronology, never null
    • getPartialValues

      public int[] getPartialValues(ReadablePartial fieldSource, Object object, Chronology chrono)
      Extracts the values of the partial from an object of this converter's type. The chrono parameter is a hint to the converter, should it require a chronology to aid in conversion.
      Specified by:
      getPartialValues in interface PartialConverter
      Overrides:
      getPartialValues in class AbstractConverter
      Parameters:
      fieldSource - a partial that provides access to the fields. This partial may be incomplete and only getFieldType(int) should be used
      object - the object to convert
      chrono - the chronology to use, which is the non-null result of getChronology()
      Returns:
      the array of field values that match the fieldSource, must be non-null valid
      Throws:
      ClassCastException - if the object is invalid
    • getSupportedType

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