V
- The type of value to be validatedpublic final class ConstraintGroupWrapper<V> extends ConstraintWrapper<V>
groups
property of the
java.lang.String[]
type.ConstraintFactory.wrapGroups(Constraint)
,
ConstraintFactory.wrapGroups(Constraint, String...)
constraint
Modifier and Type | Method and Description |
---|---|
Set<String> |
getGroups()
Returns unmodifiable set of groups the constraint is applied on.
|
String |
getMessageTemplate(ValidationContext<?> context)
Returns localized error message template of the wrapped constraint or
null if no group of this wrapper matches groups provided by
validation context. |
<T> V |
validate(V value,
ValidationContext<T> context)
Validates the specified value using context if needed and returns
possibly modified value.
|
appendMessageArguments, getConstraint, getType
public Set<String> getGroups()
public String getMessageTemplate(ValidationContext<?> context)
null
if no group of this wrapper matches groups provided by
validation context.getMessageTemplate
in interface Constraint<V>
getMessageTemplate
in interface Validation<V>
getMessageTemplate
in class ConstraintWrapper<V>
context
- Validation context.null
if no group of this wrapper matches groups
provided by validation context.Constraint.getMessageTemplate(ValidationContext)
public <T> V validate(V value, ValidationContext<T> context)
This method performs validation only if one or more groups provided by validation context match at least one group of this wrapper; otherwise it returns value as is.
validate
in interface Constraint<V>
validate
in class ConstraintWrapper<V>
T
- The type of validated entity.value
- Value to be validated.context
- Validation context.ConstraintViolationException
- if validation fails.Constraint.validate(Object, ValidationContext)
Copyright © 2011–2020 FoxLabs. All rights reserved.