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) |
EnumValidator(Class<E> enumType,
boolean nullable,
boolean allowExpressions,
E... allowed) |
EnumValidator(Class<E> enumType,
boolean nullable,
E... allowed) |
| Modifier and Type | Method and Description |
|---|---|
static <E extends Enum<E>> |
create(Class<E> enumType,
boolean nullable,
boolean allowExpressions)
Creates a new validator for the enum type with all values of the enum allowed.
|
static <E extends Enum<E>> |
create(Class<E> enumType,
boolean nullable,
boolean allowExpressions,
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,
boolean nullable,
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.
|
validateResolvedParameter@SafeVarargs public EnumValidator(Class<E> enumType, boolean nullable, E... allowed)
@SafeVarargs public EnumValidator(Class<E> enumType, boolean nullable, boolean allowExpressions, E... allowed)
@SafeVarargs public static <E extends Enum<E>> EnumValidator<E> create(Class<E> enumType, boolean nullable, E... allowed)
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.public static <E extends Enum<E>> EnumValidator<E> create(Class<E> enumType, boolean nullable, boolean allowExpressions)
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 public static <E extends Enum<E>> EnumValidator<E> create(Class<E> enumType, boolean nullable, boolean allowExpressions, E... allowed)
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 © 2015 JBoss by Red Hat. All rights reserved.