Class ReadableIntervalConverter

    • Constructor Detail

      • ReadableIntervalConverter

        protected ReadableIntervalConverter()
        Restricted constructor.
    • Method Detail

      • getDurationMillis

        public long getDurationMillis​(java.lang.Object object)
        Gets the millisecond length of the interval.
        Specified by:
        getDurationMillis in interface DurationConverter
        Parameters:
        object - the interval
        Returns:
        the millisecond duration
      • setInto

        public void setInto​(ReadWritablePeriod writablePeriod,
                            java.lang.Object object,
                            Chronology chrono)
        Sets the values of the mutable duration from the specified interval.
        Specified by:
        setInto in interface PeriodConverter
        Parameters:
        writablePeriod - the period to modify
        object - the interval to set from
        chrono - the chronology to use
      • isReadableInterval

        public boolean isReadableInterval​(java.lang.Object object,
                                          Chronology chrono)
        Checks if the input is a ReadableInterval.

        If it is, then the calling code should cast and copy the fields directly.

        Specified by:
        isReadableInterval in interface IntervalConverter
        Overrides:
        isReadableInterval in class AbstractConverter
        Parameters:
        object - the object to convert, must not be null
        chrono - the chronology to use, may be null
        Returns:
        true if the input is a ReadableInterval
        Throws:
        java.lang.ClassCastException - if the object is invalid
      • setInto

        public void setInto​(ReadWritableInterval writableInterval,
                            java.lang.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, must not be null
        chrono - the chronology to use, may be null
        Throws:
        java.lang.ClassCastException - if the object is invalid
      • getSupportedType

        public java.lang.Class<?> getSupportedType()
        Returns ReadableInterval.class.
        Specified by:
        getSupportedType in interface Converter
        Returns:
        the object type that this converter supports