Class AbstractNumberConverter<N extends java.lang.Number>

    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String convertToString​(N value, java.util.Locale locale)
      Converts the given value to a string.
      java.text.NumberFormat getNumberFormat​(java.util.Locale locale)  
      protected abstract java.text.NumberFormat newNumberFormat​(java.util.Locale locale)
      Creates a new NumberFormat for the given locale.
      protected java.math.BigDecimal parse​(java.lang.Object value, java.math.BigDecimal min, java.math.BigDecimal max, java.util.Locale locale)
      Parses a value as a String and returns a Number.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AbstractNumberConverter

        public AbstractNumberConverter()
    • Method Detail

      • getNumberFormat

        public java.text.NumberFormat getNumberFormat​(java.util.Locale locale)
        Parameters:
        locale - The locale
        Returns:
        Returns the numberFormat.
      • newNumberFormat

        protected abstract java.text.NumberFormat newNumberFormat​(java.util.Locale locale)
        Creates a new NumberFormat for the given locale. The instance is later cached and is accessible through getNumberFormat(Locale)
        Parameters:
        locale -
        Returns:
        number format
      • parse

        protected java.math.BigDecimal parse​(java.lang.Object value,
                                             java.math.BigDecimal min,
                                             java.math.BigDecimal max,
                                             java.util.Locale locale)
        Parses a value as a String and returns a Number.
        Parameters:
        value - The object to parse (after converting with toString())
        min - The minimum allowed value or null if none
        max - The maximum allowed value or null if none
        locale -
        Returns:
        The number
        Throws:
        ConversionException - if value is unparsable or out of range