V
- The type of the enumeration constantspublic abstract class EnumerationConstraint<V> extends CheckConstraint<V>
CheckConstraint
that checks whether the specified value is one of the allowed constants.Modifier and Type | Class and Description |
---|---|
static class |
EnumerationConstraint.Default<V>
This class provides default
EnumerationConstraint
implementation based on static set of constants. |
Constructor and Description |
---|
EnumerationConstraint() |
Modifier and Type | Method and Description |
---|---|
boolean |
appendMessageArguments(ValidationContext<?> context,
Map<String,Object> arguments)
Appends
constants argument that contains set of allowed
constants. |
protected <T> boolean |
check(V value,
ValidationContext<T> context)
Checks whether the specified value is one of the allowed constants.
|
abstract Set<V> |
getConstants()
Returns unmodifiable set of allowed constants.
|
Set<V> |
getSortedConstants(Locale locale)
Returns set of constants in order according to the specified locale.
|
validate
getMessageTemplate
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getMessageTemplate, getType
public abstract Set<V> getConstants()
public Set<V> getSortedConstants(Locale locale)
getConstants()
by default.locale
- Locale to be used for constants sorting.public boolean appendMessageArguments(ValidationContext<?> context, Map<String,Object> arguments)
constants
argument that contains set of allowed
constants.appendMessageArguments
in interface Constraint<V>
appendMessageArguments
in interface Validation<V>
appendMessageArguments
in class AbstractValidation<V>
context
- Validation context.arguments
- Arguments to be substituted into the error message
template.true
.protected <T> boolean check(V value, ValidationContext<T> context)
check
in class CheckConstraint<V>
T
- The type of validated entity.value
- Value to be checked.context
- Validation context.true
if the specified value is one of the allowed
constants; false
otherwise.Copyright © 2011–2020 FoxLabs. All rights reserved.