V
- The type of enumeration constantspublic static class EnumerationConstraint.Default<V> extends EnumerationConstraint<V>
EnumerationConstraint
implementation based on static set of constants.Enumeration
,
ConstraintFactory.enumeration(Class)
,
ConstraintFactory.enumeration(Object...)
,
ConstraintFactory.enumeration(Collection)
EnumerationConstraint.Default<V>
Modifier and Type | Field and Description |
---|---|
protected Set<V> |
constants
Unmodifiable set of allowed constants.
|
protected Class<?> |
type
Type of enumeration constants.
|
Modifier | Constructor and Description |
---|---|
protected |
Default(Class<?> type,
Collection<V> constants)
Constructs a new
EnumerationConstraint.Default with the
specified collection of allowed constants and their type. |
protected |
Default(Class<?> type,
Set<V> constants)
Constructs a new
EnumerationConstraint.Default with the
specified set of allowed constants and their type. |
protected |
Default(Class<?> type,
V... constants)
Constructs a new
EnumerationConstraint.Default with the
specified array of allowed constants and their type. |
protected |
Default(Class<V> type,
Enumeration annotation)
Constructs a new
EnumerationConstraint.Default from the
specified annotation and type. |
protected |
Default(Collection<V> constants)
Constructs a new
EnumerationConstraint.Default with the
specified collection of allowed constants. |
protected |
Default(V... constants)
Constructs a new
EnumerationConstraint.Default with the
specified array of allowed constants. |
Modifier and Type | Method and Description |
---|---|
Set<V> |
getConstants()
Returns unmodifiable set of allowed constants.
|
Class<?> |
getType()
Returns type of enumeration constants.
|
appendMessageArguments, check, getSortedConstants
validate
getMessageTemplate
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getMessageTemplate
protected final Class<?> type
@SafeVarargs protected Default(V... constants)
EnumerationConstraint.Default
with the
specified array of allowed constants.constants
- Array of allowed constants.IllegalArgumentException
- if the specified array of allowed
constants is null
or empty or contains
null
elements.@SafeVarargs protected Default(Class<?> type, V... constants)
EnumerationConstraint.Default
with the
specified array of allowed constants and their type.type
- Type of enumeration constants.constants
- Array of allowed constants.IllegalArgumentException
- if the specified type is
null
or the specified array of allowed
constants is null
or empty or contains
null
elements.protected Default(Collection<V> constants)
EnumerationConstraint.Default
with the
specified collection of allowed constants.constants
- Collection of allowed constants.IllegalArgumentException
- if the specified collection of
allowed constants is null
or empty or contains
null
elements.protected Default(Class<?> type, Collection<V> constants)
EnumerationConstraint.Default
with the
specified collection of allowed constants and their type.type
- Type of enumeration constants.constants
- Collection of allowed constants.IllegalArgumentException
- if the specified type is
null
or the specified collection of allowed
constants is null
or empty or contains
null
elements.protected Default(Class<?> type, Set<V> constants)
EnumerationConstraint.Default
with the
specified set of allowed constants and their type.type
- Type of enumeration constants.constants
- Set of allowed constants.IllegalArgumentException
- if the specified type is
null
or the specified set of allowed
constants is null
or empty or contains
null
elements.protected Default(Class<V> type, Enumeration annotation)
EnumerationConstraint.Default
from the
specified annotation and type.type
- Type of enumeration constants.annotation
- Constraint annotation.IllegalArgumentException
- if the specified annotation defines
empty set of allowed constants.public final Class<?> getType()
public final Set<V> getConstants()
getConstants
in class EnumerationConstraint<V>
Copyright © 2011–2020 FoxLabs. All rights reserved.