@Override public SimpleAttributeDefinitionBuilder apply(SimpleAttributeDefinitionBuilder builder) { return builder.setValidator(new EnumValidator<>(SessionDrainingStrategyEnum.class, SessionDrainingStrategyEnum.values())); } },
/** * Creates a new validator for the enum type with the allowed values defined in the {@code allowed} parameter. * * @param enumType the type of the enum. * @param allowed the enum values that are allowed. If {@code null} or zero length this is interpreted as meaning all values * @param <E> the type of the enum. * * @return a new validator. */ @SafeVarargs public static <E extends Enum<E>> EnumValidator<E> create(final Class<E> enumType, final E... allowed) { if (allowed == null || allowed.length == 0) { return create(enumType, EnumSet.allOf(enumType)); } return new EnumValidator<E>(enumType, allowed); }
/** * 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 new validator for the enum type with the allowed values defined in the {@code allowed} parameter. * * @param enumType the type of the enum. * @param allowed the enum values that are allowed. If {@code null} or zero length this is interpreted as meaning all values * @param <E> the type of the enum. * * @return a new validator. */ @SafeVarargs public static <E extends Enum<E>> EnumValidator<E> create(final Class<E> enumType, final E... allowed) { if (allowed == null || allowed.length == 0) { return create(enumType, EnumSet.allOf(enumType)); } return new EnumValidator<E>(enumType, allowed); }
/** * 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); }
.setValidator(new EnumValidator<>(BindingType.class, EnumSet.complementOf(EnumSet.of(BindingType.EXTERNAL_CONTEXT)))) .build()) .addParameter(TYPE)
/** @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); } }
/** * Creates a new validator for the enum type with the allowed values defined in the {@code allowed} parameter. * * @param enumType the type of the enum. * @param allowed the enum values that are allowed. * @param <E> the type of the enum. * * @return a new validator. */ public static <E extends Enum<E>> EnumValidator<E> create(final Class<E> enumType, final EnumSet<E> allowed) { return new EnumValidator<E>(enumType, allowed); }
/** @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); } }
/** * Creates a new validator for the enum type with the allowed values defined in the {@code allowed} parameter. * * @param enumType the type of the enum. * @param allowed the enum values that are allowed. * @param <E> the type of the enum. * * @return a new validator. */ public static <E extends Enum<E>> EnumValidator<E> create(final Class<E> enumType, final EnumSet<E> allowed) { return new EnumValidator<E>(enumType, allowed); }
/** * Creates a new validator for the enum type with all values of the enum allowed. * * @param enumType the type of the enum. * @param nullable {@code true} if the value is allowed to be {@code null}, otherwise {@code false}. * @param allowExpressions {@code true} if an expression is allowed to define the value, otherwise {@code false}. * @param <E> the type of the enum. * * @return a new validator. */ public static <E extends Enum<E>> EnumValidator<E> create(final Class<E> enumType, final boolean nullable, final boolean allowExpressions) { return new EnumValidator<E>(enumType, nullable, allowExpressions); }
/** * Creates a new validator for the enum type with the allowed values defined in the {@code allowed} parameter. * * @param enumType the type of the enum. * @param nullable {@code true} if the value is allowed to be {@code null}, otherwise {@code false}. * @param allowed the enum values that are allowed. * @param <E> the type of the enum. * * @return a new validator. */ public static <E extends Enum<E>> EnumValidator<E> create(final Class<E> enumType, final boolean nullable, final E... allowed) { return new EnumValidator<E>(enumType, nullable, allowed); }
/** * Creates a new validator for the enum type with the allowed values defined in the {@code allowed} parameter. * * @param enumType the type of the enum. * @param nullable {@code true} if the value is allowed to be {@code null}, otherwise {@code false}. * @param allowed the enum values that are allowed. * @param <E> the type of the enum. * * @return a new validator. */ public static <E extends Enum<E>> EnumValidator<E> create(final Class<E> enumType, final boolean nullable, final E... allowed) { return new EnumValidator<E>(enumType, nullable, allowed); }
/** * Creates a new validator for the enum type with all values of the enum allowed. * * @param enumType the type of the enum. * @param nullable {@code true} if the value is allowed to be {@code null}, otherwise {@code false}. * @param allowExpressions {@code true} if an expression is allowed to define the value, otherwise {@code false}. * @param <E> the type of the enum. * * @return a new validator. */ public static <E extends Enum<E>> EnumValidator<E> create(final Class<E> enumType, final boolean nullable, final boolean allowExpressions) { return new EnumValidator<E>(enumType, nullable, allowExpressions); }
/** * Creates a new validator for the enum type with the allowed values defined in the {@code allowed} parameter. * * @param enumType the type of the enum. * @param nullable {@code true} if the value is allowed to be {@code null}, otherwise {@code false}. * @param allowExpressions {@code true} if an expression is allowed to define the value, otherwise {@code false}. * @param allowed the enum values that are allowed. * @param <E> the type of the enum. * * @return a new validator. */ public static <E extends Enum<E>> EnumValidator<E> create(final Class<E> enumType, final boolean nullable, final boolean allowExpressions, final E... allowed) { return new EnumValidator<E>(enumType, nullable, allowExpressions, allowed); }
/** * Creates a new validator for the enum type with the allowed values defined in the {@code allowed} parameter. * * @param enumType the type of the enum. * @param nullable {@code true} if the value is allowed to be {@code null}, otherwise {@code false}. * @param allowExpressions {@code true} if an expression is allowed to define the value, otherwise {@code false}. * @param allowed the enum values that are allowed. * @param <E> the type of the enum. * * @return a new validator. */ public static <E extends Enum<E>> EnumValidator<E> create(final Class<E> enumType, final boolean nullable, final boolean allowExpressions, final E... allowed) { return new EnumValidator<E>(enumType, nullable, allowExpressions, allowed); }
/** * Creates a new validator for the enum type with all values of the enum allowed. * * @param enumType the type of the enum. * @param nullable {@code true} if the value is allowed to be {@code null}, otherwise {@code false}. * @param allowExpressions {@code true} if an expression is allowed to define the value, otherwise {@code false}. * @param <E> the type of the enum. * * @return a new validator. * @deprecated use {@link #create(Class, EnumSet)} with {@link EnumSet#allOf(Class)} since {@link org.jboss.as.controller.AttributeDefinition} handles the nullable and expression checks. */ @Deprecated @SuppressWarnings("deprecation") public static <E extends Enum<E>> EnumValidator<E> create(final Class<E> enumType, final boolean nullable, final boolean allowExpressions) { return new EnumValidator<E>(enumType, nullable, allowExpressions); }
/** * Creates a new validator for the enum type with all values of the enum allowed. * * @param enumType the type of the enum. * @param nullable {@code true} if the value is allowed to be {@code null}, otherwise {@code false}. * @param allowExpressions {@code true} if an expression is allowed to define the value, otherwise {@code false}. * @param <E> the type of the enum. * * @return a new validator. * @deprecated use {@link #create(Class, EnumSet)} with {@link EnumSet#allOf(Class)} since {@link org.jboss.as.controller.AttributeDefinition} handles the nullable and expression checks. */ @Deprecated @SuppressWarnings("deprecation") public static <E extends Enum<E>> EnumValidator<E> create(final Class<E> enumType, final boolean nullable, final boolean allowExpressions) { return new EnumValidator<E>(enumType, nullable, allowExpressions); }
/** * Creates a new validator for the enum type with the allowed values defined in the {@code allowed} parameter. * * @param enumType the type of the enum. * @param nullable {@code true} if the value is allowed to be {@code null}, otherwise {@code false}. * @param allowed the enum values that are allowed. * @param <E> the type of the enum. * * @return a new validator. * @deprecated use {@link #create(Class, Enum[])} since {@link org.jboss.as.controller.AttributeDefinition} handles the nullable check. */ @SafeVarargs @Deprecated @SuppressWarnings("deprecation") public static <E extends Enum<E>> EnumValidator<E> create(final Class<E> enumType, final boolean nullable, final E... allowed) { return new EnumValidator<E>(enumType, nullable, allowed); }
/** * Creates a new validator for the enum type with the allowed values defined in the {@code allowed} parameter. * * @param enumType the type of the enum. * @param nullable {@code true} if the value is allowed to be {@code null}, otherwise {@code false}. * @param allowed the enum values that are allowed. * @param <E> the type of the enum. * * @return a new validator. * @deprecated use {@link #create(Class, Enum[])} since {@link org.jboss.as.controller.AttributeDefinition} handles the nullable check. */ @SafeVarargs @Deprecated @SuppressWarnings("deprecation") public static <E extends Enum<E>> EnumValidator<E> create(final Class<E> enumType, final boolean nullable, final E... allowed) { return new EnumValidator<E>(enumType, nullable, allowed); }