public class EnumValidator<E extends Enum<E>> extends ModelTypeValidator implements AllowedValuesValidator
ParameterValidator that validates the value is a string matching
one of the Enum types.BIGDECIMAL_MAX, BIGDECIMAL_MIN, BIGINTEGER_MAX, BIGINTEGER_MIN, nullable, strictType, validTypes| Constructor and Description |
|---|
EnumValidator(Class<E> enumType,
boolean nullable,
boolean allowExpressions)
Deprecated.
use
EnumValidator(Class, EnumSet) with EnumSet.allOf(Class) since AttributeDefinition handles the nullable and expression checks. |
EnumValidator(Class<E> enumType,
boolean nullable,
boolean allowExpressions,
E... allowed)
Deprecated.
use
EnumValidator(Class, Enum[]) with EnumSet.allOf(Class) since AttributeDefinition handles the nullable and expression checks. |
EnumValidator(Class<E> enumType,
boolean nullable,
E... allowed)
Deprecated.
use
EnumValidator(Class, Enum[]) with EnumSet.allOf(Class) since AttributeDefinition handles the nullable and expressions checks. |
EnumValidator(Class<E> enumType,
E... allowed)
Creates a validator where the specified enum values are allowed
|
EnumValidator(Class<E> enumType,
EnumSet<E> allowed)
Creates a validator where the specified enum values are allowed
|
| Modifier and Type | Method and Description |
|---|---|
static <E extends Enum<E>> |
create(Class<E> enumType,
boolean nullable,
boolean allowExpressions)
Deprecated.
use
create(Class, EnumSet) with EnumSet.allOf(Class) since AttributeDefinition handles the nullable and expression checks. |
static <E extends Enum<E>> |
create(Class<E> enumType,
boolean nullable,
boolean allowExpressions,
E... allowed)
Deprecated.
use
create(Class, Enum[]) since AttributeDefinition handles the nullable and expression checks. |
static <E extends Enum<E>> |
create(Class<E> enumType,
boolean nullable,
E... allowed)
Deprecated.
use
create(Class, Enum[]) since AttributeDefinition handles the nullable check. |
static <E extends Enum<E>> |
create(Class<E> enumType,
E... allowed)
Creates a new validator for the enum type with the allowed values defined in the
allowed parameter. |
static <E extends Enum<E>> |
create(Class<E> enumType,
EnumSet<E> allowed)
Creates a new validator for the enum type with the allowed values defined in the
allowed parameter. |
List<org.jboss.dmr.ModelNode> |
getAllowedValues()
Gets the allowed values, or
null if any value is allowed. |
void |
validateParameter(String parameterName,
org.jboss.dmr.ModelNode value)
Validate the parameter with the given name.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitvalidateResolvedParameter@SafeVarargs public EnumValidator(Class<E> enumType, E... allowed)
enumType - the type of the enumallowed - the allowed values. Cannot be nullpublic EnumValidator(Class<E> enumType, EnumSet<E> allowed)
enumType - the type of the enumallowed - the allowed values. Cannot be null@SafeVarargs @Deprecated public EnumValidator(Class<E> enumType, boolean nullable, E... allowed)
EnumValidator(Class, Enum[]) with EnumSet.allOf(Class) since AttributeDefinition handles the nullable and expressions checks.@Deprecated public EnumValidator(Class<E> enumType, boolean nullable, boolean allowExpressions)
EnumValidator(Class, EnumSet) with EnumSet.allOf(Class) since AttributeDefinition handles the nullable and expression checks.@SafeVarargs @Deprecated public EnumValidator(Class<E> enumType, boolean nullable, boolean allowExpressions, E... allowed)
EnumValidator(Class, Enum[]) with EnumSet.allOf(Class) since AttributeDefinition handles the nullable and expression checks.@SafeVarargs public static <E extends Enum<E>> EnumValidator<E> create(Class<E> enumType, E... allowed)
allowed parameter.E - the type of the enum.enumType - the type of the enum.allowed - the enum values that are allowed. If null or zero length this is interpreted as meaning all valuespublic static <E extends Enum<E>> EnumValidator<E> create(Class<E> enumType, EnumSet<E> allowed)
allowed parameter.E - the type of the enum.enumType - the type of the enum.allowed - the enum values that are allowed.@SafeVarargs @Deprecated public static <E extends Enum<E>> EnumValidator<E> create(Class<E> enumType, boolean nullable, E... allowed)
create(Class, Enum[]) since AttributeDefinition handles the nullable check.allowed parameter.E - the type of the enum.enumType - the type of the enum.nullable - true if the value is allowed to be null, otherwise false.allowed - the enum values that are allowed.@Deprecated public static <E extends Enum<E>> EnumValidator<E> create(Class<E> enumType, boolean nullable, boolean allowExpressions)
create(Class, EnumSet) with EnumSet.allOf(Class) since AttributeDefinition handles the nullable and expression checks.E - the type of the enum.enumType - the type of the enum.nullable - true if the value is allowed to be null, otherwise false.allowExpressions - true if an expression is allowed to define the value, otherwise false.@SafeVarargs @Deprecated public static <E extends Enum<E>> EnumValidator<E> create(Class<E> enumType, boolean nullable, boolean allowExpressions, E... allowed)
create(Class, Enum[]) since AttributeDefinition handles the nullable and expression checks.allowed parameter.E - the type of the enum.enumType - the type of the enum.nullable - true if the value is allowed to be null, otherwise false.allowExpressions - true if an expression is allowed to define the value, otherwise false.allowed - the enum values that are allowed.public void validateParameter(String parameterName, org.jboss.dmr.ModelNode value) throws OperationFailedException
ModelTypeValidatorvalidateParameter in interface ParameterValidatorvalidateParameter in class ModelTypeValidatorparameterName - the name of the parameter. Cannot be nullvalue - the parameter value. Cannot be nullOperationFailedException - if the value is not validpublic List<org.jboss.dmr.ModelNode> getAllowedValues()
AllowedValuesValidatornull if any value is allowed.getAllowedValues in interface AllowedValuesValidatornullCopyright © 2020 JBoss by Red Hat. All rights reserved.