Interface PartialConverter

  • All Superinterfaces:
    Converter

    public interface PartialConverter
    extends Converter
    PartialConverter defines how an object is converted to a ReadablePartial.

    The two methods in this interface must be called in order, as the getPartialValues method relies on the result of the getChronology method being passed in.

    Since:
    1.0
    • Method Detail

      • getChronology

        Chronology getChronology​(java.lang.Object object,
                                 DateTimeZone zone)
        Extracts the chronology from an object of this converter's type where the time zone is specified.
        Parameters:
        object - the object to convert
        zone - the specified zone to use, null means default zone
        Returns:
        the chronology, never null
        Throws:
        java.lang.ClassCastException - if the object is invalid
        Since:
        1.3
      • getChronology

        Chronology getChronology​(java.lang.Object object,
                                 Chronology chrono)
        Extracts the chronology from an object of this converter's type where the chronology is specified.
        Parameters:
        object - the object to convert
        chrono - the chronology to use, null usually means ISO
        Returns:
        the chronology, not converted to UTC/local time zone, must be non-null valid
        Throws:
        java.lang.ClassCastException - if the object is invalid
      • getPartialValues

        int[] getPartialValues​(ReadablePartial fieldSource,
                               java.lang.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.
        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:
        java.lang.ClassCastException - if the object is invalid
      • getPartialValues

        int[] getPartialValues​(ReadablePartial fieldSource,
                               java.lang.Object object,
                               Chronology chrono,
                               DateTimeFormatter parser)
        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.
        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()
        parser - if converting from a String, the given parser is preferred
        Returns:
        the array of field values that match the fieldSource, must be non-null valid
        Throws:
        java.lang.ClassCastException - if the object is invalid
        Since:
        1.3