Class EnumValidator<E extends Enum<E>>

    • Constructor Detail

      • EnumValidator

        @SafeVarargs
        public EnumValidator​(Class<E> enumType,
                             E... allowed)
        Creates a validator where the specified enum values are allowed
        Parameters:
        enumType - the type of the enum
        allowed - the allowed values. Cannot be null
      • EnumValidator

        public EnumValidator​(Class<E> enumType,
                             EnumSet<E> allowed)
        Creates a validator where the specified enum values are allowed
        Parameters:
        enumType - the type of the enum
        allowed - the allowed values. Cannot be null
    • Method Detail

      • create

        public static <E extends Enum<E>> EnumValidator<E> create​(Class<E> enumType)
        Creates a new validator for the enum type that accepts all enum values.
        Type Parameters:
        E - the type of the enum.
        Parameters:
        enumType - the type of the enum.
        Returns:
        a new validator.
      • 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.