@SupportedValidationTarget(value=PARAMETERS) public class ParameterScriptAssertValidator extends AbstractScriptAssertValidator<ParameterScriptAssert,Object[]>
ParameterScriptAssert
constraint annotation.escapedScript, languageName, script, scriptAssertContext
Constructor and Description |
---|
ParameterScriptAssertValidator() |
Modifier and Type | Method and Description |
---|---|
void |
initialize(ConstraintDescriptor<ParameterScriptAssert> constraintDescriptor,
HibernateConstraintValidatorInitializationContext initializationContext)
Initializes the validator in preparation for
ConstraintValidator.isValid(Object, ConstraintValidatorContext) calls. |
boolean |
isValid(Object[] arguments,
ConstraintValidatorContext constraintValidatorContext)
Implements the validation logic.
|
initialize
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
initialize
public void initialize(ConstraintDescriptor<ParameterScriptAssert> constraintDescriptor, HibernateConstraintValidatorInitializationContext initializationContext)
HibernateConstraintValidator
ConstraintValidator.isValid(Object, ConstraintValidatorContext)
calls.
It is an alternative to ConstraintValidator.initialize(Annotation)
method. Should be used if any additional information
except annotation is needed to initialize a validator.
Note, when using HibernateConstraintValidator
user should only override one of the methods, either
HibernateConstraintValidator.initialize(ConstraintDescriptor, HibernateConstraintValidatorInitializationContext)
or ConstraintValidator.initialize(Annotation)
.
Both methods will be called during initialization, starting with
HibernateConstraintValidator.initialize(ConstraintDescriptor, HibernateConstraintValidatorInitializationContext)
.constraintDescriptor
- a constraint descriptor for a given constraint declarationinitializationContext
- an initialization context for a current ConstraintValidatorFactory
public boolean isValid(Object[] arguments, ConstraintValidatorContext constraintValidatorContext)
ConstraintValidator
value
must not be altered.
This method can be accessed concurrently, thread-safety must be ensured by the implementation.
arguments
- object to validateconstraintValidatorContext
- context in which the constraint is evaluatedfalse
if value
does not pass the constraintCopyright © 2019 JBoss by Red Hat. All rights reserved.