|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.dhmp.util.xml.validator.Validator
org.dhmp.util.xml.validator.NumberValidator
Validates several number related data types. Data types decimal and integer are converted to java BigDecimal. Data types double, float, long and int are converted to corresponding java objects. The conversion is locale sensitive and decimal and group separator interpretation depends on current SchemaCollection's locale.
Nested Class Summary |
Nested classes inherited from class org.dhmp.util.xml.validator.Validator |
Validator.ValidationFailed |
Field Summary | |
static int |
DECIMAL
Represents decimal data type. |
static int |
DOUBLE
Represents double data type. |
static int |
FLOAT
Represents float data type. |
static int |
INT
Represents int data type. |
static int |
INTEGER
Represents integer data type. |
static int |
LONG
Represents long data type. |
static java.math.BigDecimal |
ONE
|
static java.lang.Integer |
ZERO
|
Fields inherited from class org.dhmp.util.xml.validator.Validator |
FAIL |
Constructor Summary | |
NumberValidator(java.util.Locale locale,
int type)
Creates a new instance of DecimalValidator |
Method Summary | |
int |
compareTo(java.lang.Object o1,
java.lang.Object o2)
Abstract method for comparing two valid objects used for boundry check. |
java.lang.Object |
newValue(java.lang.Object value)
Creates a java instance of corresponding object depending on data type this Validator is written for. |
java.lang.Object |
validate(java.lang.String name,
java.lang.Object value,
HierarchicalMap constraints,
Schema schema,
HierarchicalMap messages,
int replace)
Returns true if the validation is successfull. |
Methods inherited from class org.dhmp.util.xml.validator.Validator |
appendMessage, checkBoundary, checkEnumeration, checkNillable, checkPattern, convert, hasFailed |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int DECIMAL
public static final int DOUBLE
public static final int FLOAT
public static final int INT
public static final int INTEGER
public static final int LONG
public static final java.lang.Integer ZERO
public static final java.math.BigDecimal ONE
Constructor Detail |
public NumberValidator(java.util.Locale locale, int type)
locale
- SchemaCollection's locale.type
- number data type which this validator will represent.Method Detail |
public java.lang.Object validate(java.lang.String name, java.lang.Object value, HierarchicalMap constraints, Schema schema, HierarchicalMap messages, int replace)
Validator
validate
in class Validator
name
- name of schema component beeing validated.value
- value that is beeing validated.constraints
- HierarchicalMap containing constraints.schema
- reference to Schema which is validating the current value.messages
- StringBuffer where the error messages are appended.replace
- true if value should be replaced by corresponding java Object.
public int compareTo(java.lang.Object o1, java.lang.Object o2)
Validator
compareTo
in class Validator
o1
- first object.o2
- second object.
public java.lang.Object newValue(java.lang.Object value)
Validator
newValue
in class Validator
value
- value to be converted to java object depending on data type.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |