| |
|
| javax.swing.text.NumberFormatter com.jgoodies.validation.formatter.EmptyNumberFormatter
EmptyNumberFormatter | public class EmptyNumberFormatter extends NumberFormatter (Code) | | In addition to its superclass NumberFormatter, this class converts
to/from the empty string. Therefore it holds an empty value
that is the counterpart of the empty string.
The Method #valueToString converts the empty value to the
empty string. And #stringToValue converts blank strings
to the empty value. In all other cases the conversion is delegated
to its superclass.
Often the empty value is null or -1 .
Examples:
new EmptyNumberFormatter();
new EmptyNumberFormatter(-1);
author: Karsten Lentzsch version: $Revision: 1.5 $ See Also: java.text.Format |
Constructor Summary | |
public | EmptyNumberFormatter() Constructs an EmptyNumberFormatter that converts null
to the empty string and vice versa. | public | EmptyNumberFormatter(NumberFormat format) Constructs an EmptyNumberFormatter configured with the specified
Format; converts null to the empty string and vice versa. | public | EmptyNumberFormatter(Number emptyValue) Constructs an EmptyNumberFormatter that converts the given
emptyValue to the empty string and vice versa. | public | EmptyNumberFormatter(NumberFormat format, Number emptyValue) Constructs an EmptyNumberFormatter configured with the specified
Format; converts null to the given emptyValue
and vice versa. |
Method Summary | |
public Object | stringToValue(String text) Returns the Object representation of the
String text .
Unlike its superclass, this class converts blank strings
to the empty value. | public String | valueToString(Object value) Returns a String representation of the Object value . |
EmptyNumberFormatter | public EmptyNumberFormatter()(Code) | | Constructs an EmptyNumberFormatter that converts null
to the empty string and vice versa.
|
EmptyNumberFormatter | public EmptyNumberFormatter(NumberFormat format)(Code) | | Constructs an EmptyNumberFormatter configured with the specified
Format; converts null to the empty string and vice versa.
Parameters: format - Format used to dictate legal values |
EmptyNumberFormatter | public EmptyNumberFormatter(Number emptyValue)(Code) | | Constructs an EmptyNumberFormatter that converts the given
emptyValue to the empty string and vice versa.
Parameters: emptyValue - the representation of the empty string |
EmptyNumberFormatter | public EmptyNumberFormatter(NumberFormat format, Number emptyValue)(Code) | | Constructs an EmptyNumberFormatter configured with the specified
Format; converts null to the given emptyValue
and vice versa.
Parameters: format - Format used to dictate legal values Parameters: emptyValue - the representation of the empty string |
stringToValue | public Object stringToValue(String text) throws ParseException(Code) | | Returns the Object representation of the
String text .
Unlike its superclass, this class converts blank strings
to the empty value.
Parameters: text - String to convert Object representation of text throws: ParseException - if there is an error in the conversion |
valueToString | public String valueToString(Object value) throws ParseException(Code) | | Returns a String representation of the Object value .
This invokes format on the current Format .
Unlike its superclass, this class converts the empty value
to the empty string.
Parameters: value - the value to convert a String representation of value throws: ParseException - if there is an error in the conversion |
|
|
|