|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnl.lxtreme.ols.util.swing.validation.NumberValidator
public final class NumberValidator
Provides a simple number validator.
Constructor Summary | |
---|---|
NumberValidator()
Creates a new NumberValidator instance for integer decimal values. |
|
NumberValidator(Class<?> aType)
Creates a new NumberValidator instance for numeric (decimal) values of the given type. |
|
NumberValidator(Class<?> aType,
int aRadix)
Creates a new NumberValidator instance for numeric values of the given type and radix. |
|
NumberValidator(int aRadix)
Creates a new NumberValidator instance for integer values with a given radix. |
Method Summary | |
---|---|
static boolean |
isFloatType(Class<?> aType)
Returns whether or not the given type represents a numeric floating-point type. |
static boolean |
isIntegerType(Class<?> aType)
Returns whether or not the given type represents a numeric integer-like type. |
static boolean |
isNumericType(Class<?> aType)
Returns whether or not the given type represents a numeric type. |
protected Number |
parse(String aInputText)
Parses the given input to a number, if possible. |
boolean |
validate(Object aValue)
Validates the given value. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public NumberValidator()
public NumberValidator(Class<?> aType)
aType
- the numeric type (Integer, Long, ...) to expect.public NumberValidator(Class<?> aType, int aRadix)
aType
- the numeric type (Integer, Long, ...) to expect;aRadix
- the radix of the values to expect (2, 8, 10, 16).
IllegalArgumentException
- in case the given type was either a float or double and
the radix is not 10.public NumberValidator(int aRadix)
aRadix
- the radix of the values to expect (2, 8, 10, 16).Method Detail |
---|
public static boolean isFloatType(Class<?> aType)
aType
- the type to test, can be null
.
true
if the given type represents a floating-point
type, false
otherwise.public static boolean isIntegerType(Class<?> aType)
aType
- the type to test, can be null
.
true
if the given type represents a integer-like type,
false
otherwise.public static boolean isNumericType(Class<?> aType)
aType
- the type to test, can be null
.
true
if the given type represents a numeric type,
false
otherwise.public boolean validate(Object aValue)
IValidator
validate
in interface IValidator
aValue
- the value to validate, can be null
or any object.
true
if the given value is correct, false
otherwise.IValidator.validate(java.lang.Object)
protected final Number parse(String aInputText)
aInputText
- the text to parse as number, cannot be null
.
null
in case the given text
could not be parsed.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |