Class DecimalValidator

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean isAutoTrim()
      Tell the autoTrim mode.
      protected java.lang.Number parseNumber​(java.lang.String text)
      Helper method that wraps the ParseException in a RuntimeException.
      void setAutoTrim​(boolean autoTrim)
      Set the autoTrim mode, before parsing the text (default false).
      protected java.math.BigDecimal textToBigDecimal​(java.lang.String text)
      Helper method that returns the widest number real instance, and extract later values depending on the precision needed.
      • Methods inherited from class java.lang.Object

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

      • DecimalValidator

        public DecimalValidator​(java.text.DecimalFormat format)
      • DecimalValidator

        public DecimalValidator​(java.text.DecimalFormat format,
                                java.util.Locale locale)
      • DecimalValidator

        public DecimalValidator()
      • DecimalValidator

        public DecimalValidator​(java.util.Locale locale)
    • Method Detail

      • parseNumber

        protected final java.lang.Number parseNumber​(java.lang.String text)
        Helper method that wraps the ParseException in a RuntimeException.
        Parameters:
        text - The text to parse.
        Returns:
        The number parsed from the text.
        Throws:
        java.lang.RuntimeException - if there was a parsing error.
      • textToBigDecimal

        protected final java.math.BigDecimal textToBigDecimal​(java.lang.String text)
        Helper method that returns the widest number real instance, and extract later values depending on the precision needed.
        Parameters:
        text - The text to convert.
        Returns:
        The decimal equivalent of the text or null if the text cannot be converted.
      • setAutoTrim

        public void setAutoTrim​(boolean autoTrim)
        Set the autoTrim mode, before parsing the text (default false).
        Parameters:
        autoTrim - The new auto trim value (true to trim leading and trailing blanks before parsing text).
      • isAutoTrim

        public boolean isAutoTrim()
        Tell the autoTrim mode.
        Returns:
        true if autoTrim is enabled, otherwise false (default).