public class Validator
extends java.lang.Object
The Validator
class allows an application component or client
to provide data, and determine if the data is valid for the requested type.
Modifier and Type | Method and Description |
---|---|
java.util.List |
getConstraints()
Get the list of Contraints associated with this Validator
|
static Validator |
getInstance(java.net.URL schemaURL)
This will return the instance for the specific XML Schema URL.
|
ValidatorError |
validate(java.lang.String constraintName,
java.lang.Object objToValidate)
This will validate a data value (in
String format) against
a specific constraint, and return true if that value is
valid for the constraint. |
public static Validator getInstance(java.net.URL schemaURL) throws java.io.IOException
This will return the instance for the specific XML Schema URL. If a schema exists, it is returned (as parsing will already be done); otherwise, a new instance is created, and then returned.
schemaURL
- URL
of schema to validate against.Validator
- the instance, ready to use.java.io.IOException
- when errors in parsing occur.public ValidatorError validate(java.lang.String constraintName, java.lang.Object objToValidate)
This will validate a data value (in String
format) against
a specific constraint, and return true
if that value is
valid for the constraint.
constraintName
- the identifier in the constraints to validate this
data against.objToValidate
- String
data to validate.public java.util.List getConstraints()