public final class ValidatorProvider extends Object
Validator
s.
Each Validator
must have a static factory method create
, which is either
parameterless or has exactly one parameter of type ValidatorConfiguration
.
It is thread-safe.
Constructor and Description |
---|
ValidatorProvider()
Constructs a
ValidatorProvider . |
Modifier and Type | Method and Description |
---|---|
ValidatorProvider |
createCopy()
Creates a copy of this
ValidatorProvider . |
Validator |
getForObjectType(Class<?> objectType,
String[] constraints)
Returns a
Validator for the given object type and constraints. |
Validator |
getForValidatorType(Class<? extends Validator> validatorType,
Class<?> objectType,
String[] constraints)
Returns an instance of the given
Validator type initialized with the given constraints. |
boolean |
hasValidatorFor(Class<?> objectType)
Returns true if and only if this provider has a
Validator for the given object type. |
void |
registerValidatorType(Class<?> objectType,
Class<? extends Validator> validatorType)
Registers the given
Validator type as being responsible for values of the given object type. |
public ValidatorProvider createCopy()
ValidatorProvider
.ValidatorProvider
public boolean hasValidatorFor(Class<?> objectType)
Validator
for the given object type.objectType
- the type of the object a validator is needed forValidator
for the given type; false otherwise.public Validator getForObjectType(Class<?> objectType, String[] constraints)
Validator
for the given object type and constraints.objectType
- the type of the object a validator is needed forconstraints
- the constraints the validator must be initialized withpublic Validator getForValidatorType(Class<? extends Validator> validatorType, Class<?> objectType, String[] constraints)
Validator
type initialized with the given constraints.validatorType
- the Validator
typeobjectType
- the type of the object a validator is needed forconstraints
- the constraints to initialize the validator withCopyright © 2014. All rights reserved.