Class CalendarConverter

    • Constructor Detail

      • CalendarConverter

        protected CalendarConverter()
        Restricted constructor.
    • Method Detail

      • getChronology

        public Chronology getChronology​(java.lang.Object object,
                                        Chronology chrono)
        Gets the chronology.

        If a chronology is specified then it is used. Otherwise, it is the GJChronology if a GregorianCalendar is used, BuddhistChronology if a BuddhistCalendar is used or ISOChronology otherwise. The time zone is extracted from the calendar if possible, default used if not.

        Specified by:
        getChronology in interface InstantConverter
        Specified by:
        getChronology in interface PartialConverter
        Overrides:
        getChronology in class AbstractConverter
        Parameters:
        object - the Calendar to convert, must not be null
        chrono - the chronology to use, null means use Calendar
        Returns:
        the chronology, never null
        Throws:
        java.lang.NullPointerException - if the object is null
        java.lang.ClassCastException - if the object is an invalid type
      • getChronology

        public Chronology getChronology​(java.lang.Object object,
                                        DateTimeZone zone)
        Gets the chronology, which is the GJChronology if a GregorianCalendar is used, BuddhistChronology if a BuddhistCalendar is used or ISOChronology otherwise. The time zone specified is used in preference to that on the calendar.
        Specified by:
        getChronology in interface InstantConverter
        Specified by:
        getChronology in interface PartialConverter
        Overrides:
        getChronology in class AbstractConverter
        Parameters:
        object - the Calendar to convert, must not be null
        zone - the specified zone to use, null means default zone
        Returns:
        the chronology, never null
        Throws:
        java.lang.NullPointerException - if the object is null
        java.lang.ClassCastException - if the object is an invalid type
      • getInstantMillis

        public long getInstantMillis​(java.lang.Object object,
                                     Chronology chrono)
        Gets the millis, which is the Calendar millis value.
        Specified by:
        getInstantMillis in interface InstantConverter
        Overrides:
        getInstantMillis in class AbstractConverter
        Parameters:
        object - the Calendar to convert, must not be null
        chrono - the chronology result from getChronology, non-null
        Returns:
        the millisecond value
        Throws:
        java.lang.NullPointerException - if the object is null
        java.lang.ClassCastException - if the object is an invalid type
      • getSupportedType

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