org.apache.pivot.wtk.validation
Class DecimalValidator
java.lang.Object
org.apache.pivot.wtk.validation.FormattedValidator<NumberFormat>
org.apache.pivot.wtk.validation.DecimalValidator
- All Implemented Interfaces:
- Validator
- Direct Known Subclasses:
- ComparableValidator, DoubleValidator, FloatValidator, IntValidator
public class DecimalValidator
- extends FormattedValidator<NumberFormat>
A validator for decimal values.
Method Summary |
boolean |
isAutoTrim()
tell the autoTrim mode |
protected Number |
parseNumber(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 BigDecimal |
textToBigDecimal(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 |
DecimalValidator
public DecimalValidator(DecimalFormat format)
DecimalValidator
public DecimalValidator(DecimalFormat format,
Locale locale)
DecimalValidator
public DecimalValidator()
DecimalValidator
public DecimalValidator(Locale locale)
parseNumber
protected final Number parseNumber(String text)
- helper method that wraps the ParseException in a RuntimeException.
textToBigDecimal
protected final BigDecimal textToBigDecimal(String text)
- helper method that returns the widest number real instance,
and extract later values depending on the precision needed.
setAutoTrim
public void setAutoTrim(boolean autoTrim)
- set the autoTrim mode, before parsing the text (default false)
isAutoTrim
public boolean isAutoTrim()
- tell the autoTrim mode
- Returns:
- true if autoTrim is enabled, otherwise false (default)