Class StringConverter

    • Constructor Detail

      • StringConverter

        protected StringConverter()
        Restricted constructor.
    • Method Detail

      • getInstantMillis

        public long getInstantMillis​(java.lang.Object object,
                                     Chronology chrono)
        Gets the millis, which is the ISO parsed string value.
        Specified by:
        getInstantMillis in interface InstantConverter
        Overrides:
        getInstantMillis in class AbstractConverter
        Parameters:
        object - the String to convert, must not be null
        chrono - the chronology to use, non-null result of getChronology
        Returns:
        the millisecond value
        Throws:
        java.lang.IllegalArgumentException - if the value if invalid
      • getPartialValues

        public 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. This method checks if the parser has a zone, and uses it if present. This is most useful for parsing local times with UTC.
        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()
        parser - the parser to use, may be null
        Returns:
        the array of field values that match the fieldSource, must be non-null valid
        Throws:
        java.lang.ClassCastException - if the object is invalid
        java.lang.IllegalArgumentException - if the value if invalid
        Since:
        1.3
      • getDurationMillis

        public long getDurationMillis​(java.lang.Object object)
        Gets the duration of the string using the standard type. This matches the toString() method of ReadableDuration.
        Specified by:
        getDurationMillis in interface DurationConverter
        Parameters:
        object - the String to convert, must not be null
        Returns:
        the millisecond duration
        Throws:
        java.lang.ClassCastException - if the object is invalid
      • setInto

        public void setInto​(ReadWritablePeriod period,
                            java.lang.Object object,
                            Chronology chrono)
        Extracts duration values from an object of this converter's type, and sets them into the given ReadWritableDuration.
        Specified by:
        setInto in interface PeriodConverter
        Parameters:
        period - period to get modified
        object - the String to convert, must not be null
        chrono - the chronology to use
        Throws:
        java.lang.ClassCastException - if the object is invalid
      • setInto

        public void setInto​(ReadWritableInterval writableInterval,
                            java.lang.Object object,
                            Chronology chrono)
        Sets the value of the mutable interval from the string.
        Specified by:
        setInto in interface IntervalConverter
        Parameters:
        writableInterval - the interval to set
        object - the String to convert, must not be null
        chrono - the chronology to use, may be null
      • getSupportedType

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