V
- The type of value to be validatedpublic abstract class CheckConstraint<V> extends AbstractValidation<V> implements Constraint<V>
Constraint
interface that only checks value and doesn't modify it.Constructor and Description |
---|
CheckConstraint() |
Modifier and Type | Method and Description |
---|---|
protected abstract <T> boolean |
check(V value,
ValidationContext<T> context)
Checks whether the specified value conforms this constraint rules.
|
<T> V |
validate(V value,
ValidationContext<T> context)
Performs validation of the specified value and returns unmodified value.
|
appendMessageArguments, getMessageTemplate
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
appendMessageArguments, getMessageTemplate, getType
public final <T> V validate(V value, ValidationContext<T> context)
validate
in interface Constraint<V>
T
- The type of validated entity.value
- Value to be validated.context
- Validation context.ConstraintViolationException
- if validation fails.protected abstract <T> boolean check(V value, ValidationContext<T> context)
Note that this method should not throw
ConstraintViolationException
.
T
- The type of validated entity.value
- Value to be checked.context
- Validation context.true
if the specified value conforms this
constraint rules; false
otherwise.Copyright © 2011–2020 FoxLabs. All rights reserved.