Class EnumValidator<E extends Enum<E>>

    • Method Detail

      • create

        @SafeVarargs
        public static <E extends Enum<E>> EnumValidator<E> create​(Class<E> enumType,
                                                                  E... allowed)
        Creates a new validator for the enum type with the allowed values defined in the allowed parameter.
        Type Parameters:
        E - the type of the enum.
        Parameters:
        enumType - the type of the enum.
        allowed - the enum values that are allowed. If null or zero length this is interpreted as meaning all values
        Returns:
        a new validator.
      • create

        public static <E extends Enum<E>> EnumValidator<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.
        Type Parameters:
        E - the type of the enum.
        Parameters:
        enumType - the type of the enum.
        allowed - the enum values that are allowed.
        Returns:
        a new validator.
      • create

        @SafeVarargs
        @Deprecated
        public static <E extends Enum<E>> EnumValidator<E> create​(Class<E> enumType,
                                                                  boolean nullable,
                                                                  E... allowed)
        Deprecated.
        use create(Class, Enum[]) since AttributeDefinition handles the nullable check.
        Creates a new validator for the enum type with the allowed values defined in the allowed parameter.
        Type Parameters:
        E - the type of the enum.
        Parameters:
        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.
        Returns:
        a new validator.
      • create

        @Deprecated
        public static <E extends Enum<E>> EnumValidator<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.
        Creates a new validator for the enum type with all values of the enum allowed.
        Type Parameters:
        E - the type of the enum.
        Parameters:
        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.
        Returns:
        a new validator.
      • create

        @SafeVarargs
        @Deprecated
        public static <E extends Enum<E>> EnumValidator<E> create​(Class<E> enumType,
                                                                  boolean nullable,
                                                                  boolean allowExpressions,
                                                                  E... allowed)
        Deprecated.
        use create(Class, Enum[]) since AttributeDefinition handles the nullable and expression checks.
        Creates a new validator for the enum type with the allowed values defined in the allowed parameter.
        Type Parameters:
        E - the type of the enum.
        Parameters:
        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.
        Returns:
        a new validator.