V
- The type of value to be validatedpublic interface Constraint<V> extends Validation<V>
Constraint
instances
should be obtained from ConstraintFactory
.ConstraintFactory
Modifier and Type | Method and Description |
---|---|
boolean |
appendMessageArguments(ValidationContext<?> context,
Map<String,Object> arguments)
Appends arguments to be substituted into the error message template.
|
String |
getMessageTemplate(ValidationContext<?> context)
Returns localized error message template.
|
Class<?> |
getType()
Returns the type of value to be validated.
|
<T> V |
validate(V value,
ValidationContext<T> context)
Validates the specified value using context if needed and returns
possibly modified value.
|
Class<?> getType()
getType
in interface Validation<V>
String getMessageTemplate(ValidationContext<?> context)
This method may return null
if constraint never
generates ConstraintViolationException
.
getMessageTemplate
in interface Validation<V>
context
- Validation context.boolean appendMessageArguments(ValidationContext<?> context, Map<String,Object> arguments)
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.<T> V validate(V value, ValidationContext<T> context)
T
- The type of validated entity.value
- Value to be validated.context
- Validation context.ConstraintViolationException
- if validation fails.Copyright © 2011–2020 FoxLabs. All rights reserved.