/** * Creates a validator where the specified enum values are allowed * @param enumType the type of the enum * @param allowed the allowed values. Cannot be {@code null} */ @SafeVarargs public EnumValidator(final Class<E> enumType, final E... allowed) { this(enumType, setOf(enumType, allowed), true); }
/** * Creates a validator where the specified enum values are allowed * @param enumType the type of the enum * @param allowed the allowed values. Cannot be {@code null} */ @SafeVarargs public EnumValidator(final Class<E> enumType, final E... allowed) { this(enumType, setOf(enumType, allowed), true); }
/** @deprecated use {@link #EnumValidator(Class, Enum[])} with {@link EnumSet#allOf(Class)} since {@link org.jboss.as.controller.AttributeDefinition} handles the nullable and expression checks.*/ @SafeVarargs @Deprecated public EnumValidator(final Class<E> enumType, final boolean nullable, final boolean allowExpressions, final E... allowed) { super(ModelType.STRING, nullable, allowExpressions); this.enumType = enumType; this.allowedValues = setOf(enumType, allowed); for (E value : allowed) { toStringMap.put(value.toString(), value); } }
/** @deprecated use {@link #EnumValidator(Class, Enum[])} with {@link EnumSet#allOf(Class)} since {@link org.jboss.as.controller.AttributeDefinition} handles the nullable and expression checks.*/ @SafeVarargs @Deprecated public EnumValidator(final Class<E> enumType, final boolean nullable, final boolean allowExpressions, final E... allowed) { super(ModelType.STRING, nullable, allowExpressions); this.enumType = enumType; this.allowedValues = setOf(enumType, allowed); for (E value : allowed) { toStringMap.put(value.toString(), value); } }