Class AbstractConverter

    • Constructor Detail

      • AbstractConverter

        public AbstractConverter()
    • Method Detail

      • getDefaultLocale

        public Locale getDefaultLocale()
      • setDefaultLocale

        public void setDefaultLocale​(Locale defaultLocale)
      • getDefaultPattern

        public String getDefaultPattern()
      • setDefaultPattern

        public void setDefaultPattern​(String defaultPattern)
      • doesNullValueReturnNull

        protected boolean doesNullValueReturnNull()
      • doesValueInstanceOfTypeReturnValue

        protected boolean doesValueInstanceOfTypeReturnValue()
      • shouldFallbackToRegisteredConverters

        protected boolean shouldFallbackToRegisteredConverters()
        Indicates if the registered converters should be tried if this converter does not know how to complete the conversion.
        Returns:
        true if should fallback to registered converters, false otherwise.
        Since:
        4.0.11
      • setFallbackToRegisteredConverters

        protected void setFallbackToRegisteredConverters​(boolean fallbackToRegisteredConverters)
        Sets if the registered converters should be tried if this converter does not know how to complete the conversion.

        Note that if this property is set to false, it is important not to fallback to the registered converters, since it may cause an infinite loop.

        Parameters:
        fallbackToRegisteredConverters - the value to set.
        Since:
        4.0.11
      • doConversion

        protected abstract <T> T doConversion​(Class<T> type,
                                              Object value,
                                              Locale locale,
                                              String pattern)
                                       throws UnsupportedConversionTypeException
        Converts the specified input object into an output object of the specified type.
        Type Parameters:
        T - generics support for the data type specified.
        Parameters:
        type - data type to which the value should be converted.
        value - the input value to be converted.
        locale - locale to be used during conversion, if necessary.
        pattern - converter specific conversion pattern, to be used during conversion, if necessary.
        Throws:
        UnsupportedConversionTypeException - if this converter does not supports converting to the specified type.
        Since:
        4.0.4
      • convert

        public <T> T convert​(Class<T> type,
                             Object value,
                             Locale locale,
                             String pattern)
        Description copied from interface: IConverter
        Converts the specified input object into an output object of the specified type.
        Specified by:
        convert in interface IConverter
        Type Parameters:
        T - generics support for the data type specified.
        Parameters:
        type - data type to which the value should be converted.
        value - the input value to be converted.
        locale - locale to be used during conversion, if necessary.
        pattern - converter specific conversion pattern, to be used during conversion, if necessary.
      • convert

        public <T> T convert​(Class<T> type,
                             Object value,
                             Locale locale)
        Description copied from interface: IConverter
        Converts the specified input object into an output object of the specified type.
        Specified by:
        convert in interface IConverter
        Type Parameters:
        T - generics support for the data type specified.
        Parameters:
        type - data type to which the value should be converted.
        value - the input value to be converted.
        locale - locale to be used during conversion
      • convert

        public <T> T convert​(Class<T> type,
                             Object value)
        Description copied from interface: IConverter
        Converts the specified input object into an output object of the specified type.
        Specified by:
        convert in interface IConverter
        Type Parameters:
        T - generics support for the data type specified.
        Parameters:
        type - data type to which the value should be converted.
        value - the input value to be converted.