Class NumberConverter

  • All Implemented Interfaces:
    IConverter

    public class NumberConverter
    extends AbstractConverter
    This converter is able to do conversion between Number subtypes in the java.lang package and String.
    Since:
    4.0.4
    Version:
    $Revision: 13542 $ $Date: 2011-09-19 10:21:39 -0300 (Mon, 19 Sep 2011) $
    • Constructor Detail

      • NumberConverter

        public NumberConverter()
    • Method Detail

      • createNumberFormat

        protected NumberFormat createNumberFormat​(Locale locale,
                                                  String pattern)
        Creates the NumberFormat for the given locale and pattern.
        Parameters:
        locale - the locale.
        pattern - the pattern.
        Returns:
        the DecimalFormat created.
        Since:
        4.0.4
        See Also:
        NumberFormat
      • doConversion

        protected <T> T doConversion​(Class<T> type,
                                     Object value,
                                     Locale locale,
                                     String pattern)
                              throws UnsupportedConversionTypeException
        Description copied from class: AbstractConverter
        Converts the specified input object into an output object of the specified type.
        Specified by:
        doConversion in class AbstractConverter
        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.