public final class CustomConstraint<V> extends Object implements Constraint<V>
Constraint
implementation for custom
constraints.Modifier and Type | Method and Description |
---|---|
boolean |
appendMessageArguments(ValidationContext<?> context,
Map<String,Object> arguments)
The default behavior of this method is to return
Constraint.appendMessageArguments(ValidationContext, Map) on the
composite constraint. |
String |
getMessageTemplate(ValidationContext<?> context)
The default behavior of this method is to return
Constraint.getMessageTemplate(ValidationContext) on the
composite constraint. |
Class<?> |
getType()
The default behavior of this method is to return
Constraint.getType() on the composite constraint. |
<T> V |
validate(V value,
ValidationContext<T> context)
The default behavior of this method is to return
Constraint.validate(Object, ValidationContext) on the composite
constraint. |
public Class<?> getType()
Constraint.getType()
on the composite constraint.getType
in interface Constraint<V>
getType
in interface Validation<V>
Constraint.getType()
public String getMessageTemplate(ValidationContext<?> context)
Constraint.getMessageTemplate(ValidationContext)
on the
composite constraint.getMessageTemplate
in interface Constraint<V>
getMessageTemplate
in interface Validation<V>
context
- Validation context.Constraint.getMessageTemplate(ValidationContext)
public boolean appendMessageArguments(ValidationContext<?> context, Map<String,Object> arguments)
Constraint.appendMessageArguments(ValidationContext, Map)
on the
composite constraint.appendMessageArguments
in interface Constraint<V>
appendMessageArguments
in interface Validation<V>
context
- Validation context.arguments
- Arguments to be substituted into the error message
template.true
if error message template needs to be rendered;
false
otherwise.Constraint.appendMessageArguments(ValidationContext, Map)
public <T> V validate(V value, ValidationContext<T> context)
Constraint.validate(Object, ValidationContext)
on the composite
constraint.validate
in interface Constraint<V>
T
- The type of validated entity.value
- Value to be validated.context
- Validation context.Constraint.validate(Object, ValidationContext)
Copyright © 2011–2020 FoxLabs. All rights reserved.