com.holonplatform.core

## Interface Validator<T>

- Type Parameters:
    `T` - Validation target value type
  All Superinterfaces:
    Serializable
  Functional Interface:
    This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

      @FunctionalInterface
      public interface Validator<T>
      extends Serializable

  Validate a value to check if it is valid.

  For `Validator.Validatable` classes, `validate(Object)` method can be used to check if a value is valid. An `Validator.ValidationException` with an appropriate validation error message is thrown if the value is not valid.

  `Validator.ValidatorSupport` interface should be implemented by classes which declare support for `Validator`s.

  This interface provides several static methods to obtain builtin Validators for common use cases.

  Since:
    5.0.0

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Interface and Description
    --- | ---
    `static class` | `Validator.PatternFlag` Pattern validation regexp flags
    `static class` | `Validator.UnsupportedValidationTypeException` Exception thrown by a `Validator` when given value to validate is of an unsupported type.
    `static interface` | `Validator.Validatable<T>` Declares the support for value validation using `Validator`s.
    `static class` | `Validator.ValidationException` Exception used to notify validation errors using `validate(Object)`.
    `static class` | `Validator.ValidationMessage` Validation messages for common validators
    `static interface` | `Validator.ValidatorSupport<T>` Declares support for adding and removing `Validator`s.

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `DEFAULT_MESSAGE_CODE_PREFIX` Validation message localization code common prefix

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `static <T> Validator<T>` | `create(Predicate<T> predicate, Localizable message)` Create a `Validator` which uses given `Predicate` to perform value validation and the given localizable `message` as invalid value message when the predicate condition is not satisfied.
    `static <T> Validator<T>` | `create(Predicate<T> predicate, String message)` Create a `Validator` which uses given `Predicate` to perform value validation and the given localizable `message` as invalid value message when the predicate condition is not satisfied.
    `static <T> Validator<T>` | `create(Predicate<T> predicate, String message, String messageCode, Object... messageAguments)` Create a `Validator` which uses given `Predicate` to perform value validation and the given localizable `message` as invalid value message when the predicate condition is not satisfied.
    `static <T extends Number> Validator<T>` | `digits(int integral, int fractional)` Build a validator that checks that given `Number` value is a number within accepted range, using default `Validator.ValidationMessage.DIGITS` message as validation error message.
    `static <T extends Number> Validator<T>` | `digits(int integral, int fractional, Localizable message)` Build a validator that checks that given `Number` value is a number within accepted range, using given `Localizable` message as validation error message.
    `static <T extends Number> Validator<T>` | `digits(int integral, int fractional, String message, String messageCode)` Build a validator that checks that given `Number` value is a number within accepted range.
    `static <T extends CharSequence> Validator<T>` | `email()` Build a validator that checks that the value is a valid e-mail address using RFC822 format rules, and uses default `Validator.ValidationMessage.EMAIL` message as validation error message.
    `static <T extends CharSequence> Validator<T>` | `email(Localizable message)` Build a validator that checks that the value is a valid e-mail address using RFC822 format rules, and uses given `Localizable` message as validation error message.
    `static <T extends CharSequence> Validator<T>` | `email(String message, String messageCode)` Build a validator that checks that the value is a valid e-mail address using RFC822 format rules.
    `static <T extends Date> Validator<T>` | `future(boolean includeTime)` Build a validator that checks that given `Date` value is in the future, using default `Validator.ValidationMessage.FUTURE` message as validation error message.
    `static <T extends Date> Validator<T>` | `future(boolean includeTime, Localizable message)` Build a validator that checks that given `Date` value is in the future, using given `Localizable` message as validation error message.
    `static <T extends Date> Validator<T>` | `future(boolean includeTime, String message, String messageCode)` Build a validator that checks that given `Date` value is in the future.
    `static <T extends Comparable<T>> Validator<T>` | `greaterOrEqual(T compareTo)` Build a validator that checks that a value is greater than or equal to given `compareTo` value, and uses default `Validator.ValidationMessage.GREATER_OR_EQUAL` message as validation error message.
    `static <T extends Comparable<T>> Validator<T>` | `greaterOrEqual(T compareTo, Localizable message)` Build a validator that checks that a value is greater than or equal to given `compareTo` value, and uses given `Localizable` message as validation error message.
    `static <T extends Comparable<T>> Validator<T>` | `greaterOrEqual(T compareTo, String message, String messageCode)` Build a validator that checks that a value is greater than or equal to given `compareTo` value.
    `static <T extends Comparable<T>> Validator<T>` | `greaterThan(T compareTo)` Build a validator that checks that a value is greater than given `compareTo` value, and uses default `Validator.ValidationMessage.LESS_THAN` message as validation error message.
    `static <T extends Comparable<T>> Validator<T>` | `greaterThan(T compareTo, Localizable message)` Build a validator that checks that a value is greater than given `compareTo` value, and uses given `Localizable` message as validation error message.
    `static <T extends Comparable<T>> Validator<T>` | `greaterThan(T compareTo, String message, String messageCode)` Build a validator that checks that a value is greater than given `compareTo` value.
    `static <T> Validator<T>` | `in(Localizable message, T... values)` Build a validator that checks that given value is not `null` and equals to one of the given values, using given `Localizable` message as validation error.
    `static <T> Validator<T>` | `in(String message, String messageCode, T... values)` Build a validator that checks that given value is not `null` and equals to one of the given values.
    `static <T> Validator<T>` | `in(T... values)` Build a validator that checks that given value is not `null` and equals to one of the given values, using default `Validator.ValidationMessage.IN` ad validation error message.
    `static <T> Validator<T>` | `isNull()` Build a validator that checks that given value is `null` and uses default `Validator.ValidationMessage.NULL` localizable message as validation error message.
    `static <T> Validator<T>` | `isNull(Localizable message)` Build a validator that checks that given value is `null` and uses given `Localizable` `message` as validation error message.
    `static <T> Validator<T>` | `isNull(String message, String messageCode)` Build a validator that checks that given value is `null`.
    `static <T extends Comparable<T>> Validator<T>` | `lessOrEqual(T compareTo)` Build a validator that checks that a value is less than or equal to given `compareTo` value, and uses default `Validator.ValidationMessage.LESS_OR_EQUAL` message as validation error message.
    `static <T extends Comparable<T>> Validator<T>` | `lessOrEqual(T compareTo, Localizable message)` Build a validator that checks that a value is less than or equal to given `compareTo` value, and uses given `Localizable` message as validation error message.
    `static <T extends Comparable<T>> Validator<T>` | `lessOrEqual(T compareTo, String message, String messageCode)` Build a validator that checks that a value is less than or equal to given `compareTo` value.
    `static <T extends Comparable<T>> Validator<T>` | `lessThan(T compareTo)` Build a validator that checks that a value is less than given `compareTo` value, and uses default `Validator.ValidationMessage.LESS_THAN` message as validation error message.
    `static <T extends Comparable<T>> Validator<T>` | `lessThan(T compareTo, Localizable message)` Build a validator that checks that a value is less than given `compareTo` value, and uses given `Localizable` message as validation error message.
    `static <T extends Comparable<T>> Validator<T>` | `lessThan(T compareTo, String message, String messageCode)` Build a validator that checks that a value is less than given `compareTo` value.
    `static <T> Validator<T>` | `max(double max)` Build a validator that checks that given value is lower than or equal to `max` value, and uses `Validator.ValidationMessage.MAX` as validation error message.
    `static <T> Validator<T>` | `max(double max, Localizable message)` Build a validator that checks that given value is lower than or equal to `max` value, and uses given `Localizable` `message` as validation error message.
    `static <T> Validator<T>` | `max(double max, String message, String messageCode)` Build a validator that checks that given value is lower than or equal to `max` value.
    `static <T> Validator<T>` | `min(double min)` Build a validator that checks that given value is greater than or equal to `min` value, and uses `Validator.ValidationMessage.MAX` as validation error message.
    `static <T> Validator<T>` | `min(double min, Localizable message)` Build a validator that checks that given value is greater than or equal to `min` value, and uses given `Localizable` `message` as validation error message.
    `static <T> Validator<T>` | `min(double min, String message, String messageCode)` Build a validator that checks that given value is greater than or equal to `min` value.
    `static <T extends CharSequence> Validator<T>` | `notBlank()` Build a validator that checks that given value is not `null` nor empty, trimming spaces, and uses default `Validator.ValidationMessage.NOT_EMPTY` localizable message as validation error message.
    `static <T extends CharSequence> Validator<T>` | `notBlank(Localizable message)` Build a validator that checks that given value is not `null` nor empty, trimming spaces, and uses given `Localizable` `message` as validation error message.
    `static <T extends CharSequence> Validator<T>` | `notBlank(String message, String messageCode)` Build a validator that checks that given value is not `null` nor empty, trimming spaces.
    `static <T> Validator<T>` | `notEmpty()` Build a validator that checks that given value is not `null` nor empty, and uses default `Validator.ValidationMessage.NOT_EMPTY` localizable message as validation error message.
    `static <T> Validator<T>` | `notEmpty(Localizable message)` Build a validator that checks that given value is not `null` nor empty, and uses given `Localizable` `message` as validation error message.
    `static <T> Validator<T>` | `notEmpty(String message, String messageCode)` Build a validator that checks that given value is not `null` nor empty.
    `static <T> Validator<T>` | `notIn(Localizable message, T... values)` Build a validator that checks that given value not equals to any of the given values, using given `Localizable` message as validation error.
    `static <T> Validator<T>` | `notIn(String message, String messageCode, T... values)` Build a validator that checks that given value not equals to any of the given values.
    `static <T> Validator<T>` | `notIn(T... values)` Build a validator that checks that given value not equals to any of the given values, using default `Validator.ValidationMessage.NOT_IN` ad validation error message.
    `static <T extends Number> Validator<T>` | `notNegative()` Build a validator that checks that given `Number` value is not negative, using default `Validator.ValidationMessage.NOT_NEGATIVE` message as validation error message.
    `static <T extends Number> Validator<T>` | `notNegative(Localizable message)` Build a validator that checks that given `Number` value is not negative, using given `Localizable` message as validation error message.
    `static <T extends Number> Validator<T>` | `notNegative(String message, String messageCode)` Build a validator that checks that given `Number` value is not negative.
    `static <T> Validator<T>` | `notNull()` Build a validator that checks that given value is not `null` and uses default `Validator.ValidationMessage.NOT_NULL` localizable message as validation error message.
    `static <T> Validator<T>` | `notNull(Localizable message)` Build a validator that checks that given value is not `null` and uses given `Localizable` `message` as validation error message.
    `static <T> Validator<T>` | `notNull(String message, String messageCode)` Build a validator that checks that given value is not `null`.
    `static <T extends Date> Validator<T>` | `past(boolean includeTime)` Build a validator that checks that given `Date` value is in the past, using default `Validator.ValidationMessage.PAST` message as validation error message.
    `static <T extends Date> Validator<T>` | `past(boolean includeTime, Localizable message)` Build a validator that checks that given `Date` value is in the past, using given `Localizable` message as validation error message.
    `static <T extends Date> Validator<T>` | `past(boolean includeTime, String message, String messageCode)` Build a validator that checks that given `Date` value is in the past.
    `static <T extends CharSequence> Validator<T>` | `pattern(String regex, Localizable message, Validator.PatternFlag... flags)` Build a validator that checks that given value matches a regular expression, and uses given `Localizable` `message` as validation error message.
    `static <T extends CharSequence> Validator<T>` | `pattern(String regex, String message, String messageCode, Validator.PatternFlag... flags)` Build a validator that checks that given value matches a regular expression.
    `static <T extends CharSequence> Validator<T>` | `pattern(String regex, Validator.PatternFlag... flags)` Build a validator that checks that given value matches a regular expression, and uses `Validator.ValidationMessage.PATTERN` as validation error message.
    `void` | `validate(T value)` Validate given `value`.

- - ### Field Detail

    - #### DEFAULT_MESSAGE_CODE_PREFIX

          static final String DEFAULT_MESSAGE_CODE_PREFIX

      Validation message localization code common prefix
      See Also:
        Constant Field Values

  - ### Method Detail

    - #### validate

          void validate(T value)
                 throws Validator.ValidationException

      Validate given `value`. If the value is not valid, an `Validator.ValidationException` is thrown.

      The `Validator.ValidationException` is `Localizable`, providing optional message code and arguments for validation message localization.

      Parameters:
        `value` - The value to validate (may be null)
      Throws:
        `Validator.ValidationException` - If the value is not valid, providing the validation error message.

    - #### create

          static <T> Validator<T> create(Predicate<T> predicate,
                                         Localizable message)

      Create a `Validator` which uses given `Predicate` to perform value validation and the given localizable `message` as invalid value message when the predicate condition is not satisfied.
      Type Parameters:
        `T` - Value type
      Parameters:
        `predicate` - Predicate to use to check if value is valid (not null)
        `message` - Invalid value message (not null)
      Returns:
        A new `Validator` using given `Predicate` and invalid value message

    - #### create

          static <T> Validator<T> create(Predicate<T> predicate,
                                         String message,
                                         String messageCode,
                                         Object... messageAguments)

      Create a `Validator` which uses given `Predicate` to perform value validation and the given localizable `message` as invalid value message when the predicate condition is not satisfied.
      Type Parameters:
        `T` - Value type
      Parameters:
        `predicate` - Predicate to use to check if value is valid (not null)
        `message` - Invalid value message
        `messageCode` - Invalid value message localization code
        `messageAguments` - Optional message localization arguments
      Returns:
        A new `Validator` using given `Predicate` and invalid value message

    - #### create

          static <T> Validator<T> create(Predicate<T> predicate,
                                         String message)

      Create a `Validator` which uses given `Predicate` to perform value validation and the given localizable `message` as invalid value message when the predicate condition is not satisfied.
      Type Parameters:
        `T` - Value type
      Parameters:
        `predicate` - Predicate to use to check if value is valid (not null)
        `message` - Invalid value message
      Returns:
        A new `Validator` using given `Predicate` and invalid value message

    - #### isNull

          static <T> Validator<T> isNull()

      Build a validator that checks that given value is `null` and uses default `Validator.ValidationMessage.NULL` localizable message as validation error message.

      Supported data types: all

      Type Parameters:
        `T` - Validator type
      Returns:
        Validator

    - #### isNull

          static <T> Validator<T> isNull(Localizable message)

      Build a validator that checks that given value is `null` and uses given `Localizable` `message` as validation error message.

      Supported data types: all

      Type Parameters:
        `T` - Validator type
      Parameters:
        `message` - Validation error message
      Returns:
        Validator

    - #### isNull

          static <T> Validator<T> isNull(String message,
                                         String messageCode)

      Build a validator that checks that given value is `null`.

      Supported data types: all

      Type Parameters:
        `T` - Validator type
      Parameters:
        `message` - Validation error message
        `messageCode` - Optional validation error message localization code
      Returns:
        Validator

    - #### notNull

          static <T> Validator<T> notNull()

      Build a validator that checks that given value is not `null` and uses default `Validator.ValidationMessage.NOT_NULL` localizable message as validation error message.

      Supported data types: all

      Type Parameters:
        `T` - Validator type
      Returns:
        Validator

    - #### notNull

          static <T> Validator<T> notNull(Localizable message)

      Build a validator that checks that given value is not `null` and uses given `Localizable` `message` as validation error message.

      Supported data types: all

      Type Parameters:
        `T` - Validator type
      Parameters:
        `message` - Validation error message
      Returns:
        Validator

    - #### notNull

          static <T> Validator<T> notNull(String message,
                                          String messageCode)

      Build a validator that checks that given value is not `null`.

      Supported data types: all

      Type Parameters:
        `T` - Validator type
      Parameters:
        `message` - Validation error message
        `messageCode` - Optional validation error message localization code
      Returns:
        Validator

    - #### notEmpty

          static <T> Validator<T> notEmpty()

      Build a validator that checks that given value is not `null` nor empty, and uses default `Validator.ValidationMessage.NOT_EMPTY` localizable message as validation error message.

      Supported data types: `CharSequence`, `Collection`, `Map` and Arrays

      Type Parameters:
        `T` - Validator type
      Returns:
        Validator
      Throws:
        `Validator.UnsupportedValidationTypeException` - If value to validate is of an unsupported data type

    - #### notEmpty

          static <T> Validator<T> notEmpty(Localizable message)

      Build a validator that checks that given value is not `null` nor empty, and uses given `Localizable` `message` as validation error message.

      Supported data types: `CharSequence`, `Collection`, `Map` and Arrays

      Type Parameters:
        `T` - Validator type
      Parameters:
        `message` - Validation error message
      Returns:
        Validator
      Throws:
        `Validator.UnsupportedValidationTypeException` - If value to validate is of an unsupported data type

    - #### notEmpty

          static <T> Validator<T> notEmpty(String message,
                                           String messageCode)

      Build a validator that checks that given value is not `null` nor empty.

      Supported data types: `CharSequence`, `Collection`, `Map` and Arrays

      Type Parameters:
        `T` - Validator type
      Parameters:
        `message` - Validation error message
        `messageCode` - Optional validation error message localization code
      Returns:
        Validator
      Throws:
        `Validator.UnsupportedValidationTypeException` - If value to validate is of an unsupported data type

    - #### notBlank

          static <T extends CharSequence> Validator<T> notBlank()

      Build a validator that checks that given value is not `null` nor empty, trimming spaces, and uses default `Validator.ValidationMessage.NOT_EMPTY` localizable message as validation error message.

      Supported data types: `CharSequence`

      Type Parameters:
        `T` - Validator type
      Returns:
        Validator

    - #### notBlank

          static <T extends CharSequence> Validator<T> notBlank(Localizable message)

      Build a validator that checks that given value is not `null` nor empty, trimming spaces, and uses given `Localizable` `message` as validation error message.

      Supported data types: `CharSequence`

      Type Parameters:
        `T` - Validator type
      Parameters:
        `message` - Validation error message
      Returns:
        Validator

    - #### notBlank

          static <T extends CharSequence> Validator<T> notBlank(String message,
                                                                String messageCode)

      Build a validator that checks that given value is not `null` nor empty, trimming spaces.

      Supported data types: `CharSequence`

      Type Parameters:
        `T` - Validator type
      Parameters:
        `message` - Validation error message
        `messageCode` - Optional validation error message localization code
      Returns:
        Validator

    - #### max

          static <T> Validator<T> max(double max)

      Build a validator that checks that given value is lower than or equal to `max` value, and uses `Validator.ValidationMessage.MAX` as validation error message.

      Supported data types: `CharSequence`, `Number`, `Collection`, `Map` and arrays.

      - String: the string length is checked against given max value (converted to a long)
      - Integer numbers: the number value is checked against given max value (converted to a long)
      - Decimal numbers: the number value is checked against given max value
      - Collections, Maps and arrays: size/length is checked against given max value

      If the data type only supports integer max value validation (for example, a String length), the given `max` value is treated as an integer value, casting it to an `int` or a `long`.

      Type Parameters:
        `T` - Validator type
      Parameters:
        `max` - Max value
      Returns:
        Validator
      Throws:
        `Validator.UnsupportedValidationTypeException` - If value to validate is of an unsupported data type

    - #### max

          static <T> Validator<T> max(double max,
                                      Localizable message)

      Build a validator that checks that given value is lower than or equal to `max` value, and uses given `Localizable` `message` as validation error message.

      Supported data types: `CharSequence`, `Number`, `Collection`, `Map` and arrays.

      - String: the string length is checked against given max value (converted to a long)
      - Integer numbers: the number value is checked against given max value (converted to a long)
      - Decimal numbers: the number value is checked against given max value
      - Collections, Maps and arrays: size/length is checked against given max value

      If the data type only supports integer max value validation (for example, a String length), the given `max` value is treated as an integer value, casting it to an `int` or a `long`.

      Type Parameters:
        `T` - Validator type
      Parameters:
        `max` - Max value
        `message` - Validation error message
      Returns:
        Validator
      Throws:
        `Validator.UnsupportedValidationTypeException` - If value to validate is of an unsupported data type

    - #### max

          static <T> Validator<T> max(double max,
                                      String message,
                                      String messageCode)

      Build a validator that checks that given value is lower than or equal to `max` value.

      Supported data types: `CharSequence`, `Number`, `Collection`, `Map` and arrays.

      - String: the string length is checked against given max value (converted to a long)
      - Integer numbers: the number value is checked against given max value (converted to a long)
      - Decimal numbers: the number value is checked against given max value
      - Collections, Maps and arrays: size/length is checked against given max value

      If the data type only supports integer max value validation (for example, a String length), the given `max` value is treated as an integer value, casting it to an `int` or a `long`.

      Type Parameters:
        `T` - Validator type
      Parameters:
        `max` - Max value
        `message` - Validation error message
        `messageCode` - Optional validation error message localization code
      Returns:
        Validator
      Throws:
        `Validator.UnsupportedValidationTypeException` - If value to validate is of an unsupported data type

    - #### min

          static <T> Validator<T> min(double min)

      Build a validator that checks that given value is greater than or equal to `min` value, and uses `Validator.ValidationMessage.MAX` as validation error message.

      Null values are ignored.

      Supported data types: `CharSequence`, `Number`, `Collection`, `Map` and arrays.

      - String: the string length is checked against given min value (converted to a long)
      - Integer numbers: the number value is checked against given min value (converted to a long)
      - Decimal numbers: the number value is checked against given min value
      - Collections, Maps and arrays: size/length is checked against given min value

      If the data type only supports integer max value validation (for example, a String length), the given `max` value is treated as an integer value, casting it to an `int` or a `long`.

      Type Parameters:
        `T` - Validator type
      Parameters:
        `min` - Min value
      Returns:
        Validator
      Throws:
        `Validator.UnsupportedValidationTypeException` - If value to validate is of an unsupported data type

    - #### min

          static <T> Validator<T> min(double min,
                                      Localizable message)

      Build a validator that checks that given value is greater than or equal to `min` value, and uses given `Localizable` `message` as validation error message.

      Null values are ignored.

      Supported data types: `CharSequence`, `Number`, `Collection`, `Map` and arrays.

      - String: the string length is checked against given min value (converted to a long)
      - Integer numbers: the number value is checked against given min value (converted to a long)
      - Decimal numbers: the number value is checked against given min value
      - Collections, Maps and arrays: size/length is checked against given min value

      If the data type only supports integer max value validation (for example, a String length), the given `max` value is treated as an integer value, casting it to an `int` or a `long`.

      Type Parameters:
        `T` - Validator type
      Parameters:
        `min` - Min value
        `message` - Validation error message
      Returns:
        Validator
      Throws:
        `Validator.UnsupportedValidationTypeException` - If value to validate is of an unsupported data type

    - #### min

          static <T> Validator<T> min(double min,
                                      String message,
                                      String messageCode)

      Build a validator that checks that given value is greater than or equal to `min` value.

      Null values are ignored.

      Supported data types: `CharSequence`, `Number`, `Collection`, `Map` and arrays.

      - String: the string length is checked against given min value (converted to a long)
      - Integer numbers: the number value is checked against given min value (converted to a long)
      - Decimal numbers: the number value is checked against given min value
      - Collections, Maps and arrays: size/length is checked against given min value

      If the data type only supports integer max value validation (for example, a String length), the given `max` value is treated as an integer value, casting it to an `int` or a `long`.

      Type Parameters:
        `T` - Validator type
      Parameters:
        `min` - Min value
        `message` - Validation error message
        `messageCode` - Optional validation error message localization code
      Returns:
        Validator
      Throws:
        `Validator.UnsupportedValidationTypeException` - If value to validate is of an unsupported data type

    - #### pattern

          static <T extends CharSequence> Validator<T> pattern(String regex,
                                                               Validator.PatternFlag... flags)

      Build a validator that checks that given value matches a regular expression, and uses `Validator.ValidationMessage.PATTERN` as validation error message.

      Supported data types: `CharSequence`

      Type Parameters:
        `T` - Validator type
      Parameters:
        `regex` - Regular expression to match
        `flags` - Optional `Validator.PatternFlag` to considered when resolving the regular expression
      Returns:
        Validator

    - #### pattern

          static <T extends CharSequence> Validator<T> pattern(String regex,
                                                               Localizable message,
                                                               Validator.PatternFlag... flags)

      Build a validator that checks that given value matches a regular expression, and uses given `Localizable` `message` as validation error message.

      Supported data types: `CharSequence`

      Type Parameters:
        `T` - Validator type
      Parameters:
        `regex` - Regular expression to match
        `message` - Localizable error message
        `flags` - Optional `Validator.PatternFlag` to considered when resolving the regular expression
      Returns:
        Validator

    - #### pattern

          static <T extends CharSequence> Validator<T> pattern(String regex,
                                                               String message,
                                                               String messageCode,
                                                               Validator.PatternFlag... flags)

      Build a validator that checks that given value matches a regular expression.

      Supported data types: `CharSequence`

      Type Parameters:
        `T` - Validator type
      Parameters:
        `regex` - Regular expression to match
        `message` - Validation error message
        `messageCode` - Optional validation error message localization code
        `flags` - Optional `Validator.PatternFlag` to considered when resolving the regular expression
      Returns:
        Validator

    - #### in

          @SafeVarargs
          static <T> Validator<T> in(T... values)

      Build a validator that checks that given value is not `null` and equals to one of the given values, using default `Validator.ValidationMessage.IN` ad validation error message.

      Supported data types: all

      Type Parameters:
        `T` - Value and validator type
      Parameters:
        `values` - Values to match
      Returns:
        Validator

    - #### in

          @SafeVarargs
          static <T> Validator<T> in(Localizable message,
                                                   T... values)

      Build a validator that checks that given value is not `null` and equals to one of the given values, using given `Localizable` message as validation error.

      Supported data types: all

      Type Parameters:
        `T` - Value and validator type
      Parameters:
        `message` - Validation error message
        `values` - Values to match
      Returns:
        Validator

    - #### in

          @SafeVarargs
          static <T> Validator<T> in(String message,
                                                   String messageCode,
                                                   T... values)

      Build a validator that checks that given value is not `null` and equals to one of the given values.

      Supported data types: all

      Type Parameters:
        `T` - Value and validator type
      Parameters:
        `values` - Values to match
        `message` - Validation error message
        `messageCode` - Optional validation error message localization code
      Returns:
        Validator

    - #### notIn

          @SafeVarargs
          static <T> Validator<T> notIn(T... values)

      Build a validator that checks that given value not equals to any of the given values, using default `Validator.ValidationMessage.NOT_IN` ad validation error message.

      Supported data types: all

      Type Parameters:
        `T` - Value and validator type
      Parameters:
        `values` - Values to exclude
      Returns:
        Validator

    - #### notIn

          @SafeVarargs
          static <T> Validator<T> notIn(Localizable message,
                                                      T... values)

      Build a validator that checks that given value not equals to any of the given values, using given `Localizable` message as validation error.

      Supported data types: all

      Type Parameters:
        `T` - Value and validator type
      Parameters:
        `message` - Validation error message
        `values` - Values to exclude
      Returns:
        Validator

    - #### notIn

          @SafeVarargs
          static <T> Validator<T> notIn(String message,
                                                      String messageCode,
                                                      T... values)

      Build a validator that checks that given value not equals to any of the given values.

      Supported data types: all

      Type Parameters:
        `T` - Value and validator type
      Parameters:
        `values` - Values to exclude
        `message` - Validation error message
        `messageCode` - Optional validation error message localization code
      Returns:
        Validator

    - #### notNegative

          static <T extends Number> Validator<T> notNegative()

      Build a validator that checks that given `Number` value is not negative, using default `Validator.ValidationMessage.NOT_NEGATIVE` message as validation error message.

      Supported data types: `Number`

      Type Parameters:
        `T` - Validator type
      Returns:
        Validator

    - #### notNegative

          static <T extends Number> Validator<T> notNegative(Localizable message)

      Build a validator that checks that given `Number` value is not negative, using given `Localizable` message as validation error message.

      Supported data types: `Number`

      Type Parameters:
        `T` - Validator type
      Parameters:
        `message` - Validation error message
      Returns:
        Validator

    - #### notNegative

          static <T extends Number> Validator<T> notNegative(String message,
                                                             String messageCode)

      Build a validator that checks that given `Number` value is not negative.

      Supported data types: `Number`

      Type Parameters:
        `T` - Validator type
      Parameters:
        `message` - Validation error message
        `messageCode` - Optional validation error message localization code
      Returns:
        Validator

    - #### digits

          static <T extends Number> Validator<T> digits(int integral,
                                                        int fractional)

      Build a validator that checks that given `Number` value is a number within accepted range, using default `Validator.ValidationMessage.DIGITS` message as validation error message.

      Supported data types: `Number`

      Type Parameters:
        `T` - Validator type
      Parameters:
        `integral` - maximum number of integral digits accepted for this number (not negative)
        `fractional` - maximum number of fractional digits accepted for this number (not negative)
      Returns:
        Validator

    - #### digits

          static <T extends Number> Validator<T> digits(int integral,
                                                        int fractional,
                                                        Localizable message)

      Build a validator that checks that given `Number` value is a number within accepted range, using given `Localizable` message as validation error message.

      Supported data types: `Number`

      Type Parameters:
        `T` - Validator type
      Parameters:
        `integral` - maximum number of integral digits accepted for this number (not negative)
        `fractional` - maximum number of fractional digits accepted for this number (not negative)
        `message` - Validation error message
      Returns:
        Validator

    - #### digits

          static <T extends Number> Validator<T> digits(int integral,
                                                        int fractional,
                                                        String message,
                                                        String messageCode)

      Build a validator that checks that given `Number` value is a number within accepted range.

      Supported data types: `Number`

      Type Parameters:
        `T` - Validator type
      Parameters:
        `integral` - maximum number of integral digits accepted for this number (not negative)
        `fractional` - maximum number of fractional digits accepted for this number (not negative)
        `message` - Validation error message
        `messageCode` - Optional validation error message localization code
      Returns:
        Validator

    - #### past

          static <T extends Date> Validator<T> past(boolean includeTime)

      Build a validator that checks that given `Date` value is in the past, using default `Validator.ValidationMessage.PAST` message as validation error message.

      Supported data types: `Date`

      Type Parameters:
        `T` - Validator type
      Parameters:
        `includeTime` - Whether to include time in validation. If `false`, only year/month/day are considered.
      Returns:
        Validator

    - #### past

          static <T extends Date> Validator<T> past(boolean includeTime,
                                                    Localizable message)

      Build a validator that checks that given `Date` value is in the past, using given `Localizable` message as validation error message.

      Supported data types: `Date`

      Type Parameters:
        `T` - Validator type
      Parameters:
        `includeTime` - Whether to include time in validation. If `false`, only year/month/day are considered.
        `message` - Validation error message
      Returns:
        Validator

    - #### past

          static <T extends Date> Validator<T> past(boolean includeTime,
                                                    String message,
                                                    String messageCode)

      Build a validator that checks that given `Date` value is in the past.

      Supported data types: `Date`

      Type Parameters:
        `T` - Validator type
      Parameters:
        `includeTime` - Whether to include time in validation. If `false`, only year/month/day are considered.
        `message` - Validation error message
        `messageCode` - Optional validation error message localization code
      Returns:
        Validator

    - #### future

          static <T extends Date> Validator<T> future(boolean includeTime)

      Build a validator that checks that given `Date` value is in the future, using default `Validator.ValidationMessage.FUTURE` message as validation error message.

      Supported data types: `Date`

      Type Parameters:
        `T` - Validator type
      Parameters:
        `includeTime` - Whether to include time in validation. If `false`, only year/month/day are considered.
      Returns:
        Validator

    - #### future

          static <T extends Date> Validator<T> future(boolean includeTime,
                                                      Localizable message)

      Build a validator that checks that given `Date` value is in the future, using given `Localizable` message as validation error message.

      Supported data types: `Date`

      Type Parameters:
        `T` - Validator type
      Parameters:
        `includeTime` - Whether to include time in validation. If `false`, only year/month/day are considered.
        `message` - Validation error message
      Returns:
        Validator

    - #### future

          static <T extends Date> Validator<T> future(boolean includeTime,
                                                      String message,
                                                      String messageCode)

      Build a validator that checks that given `Date` value is in the future.

      Supported data types: `Date`

      Type Parameters:
        `T` - Validator type
      Parameters:
        `includeTime` - Whether to include time in validation. If `false`, only year/month/day are considered.
        `message` - Validation error message
        `messageCode` - Optional validation error message localization code
      Returns:
        Validator

    - #### lessThan

          static <T extends Comparable<T>> Validator<T> lessThan(T compareTo)

      Build a validator that checks that a value is less than given `compareTo` value, and uses default `Validator.ValidationMessage.LESS_THAN` message as validation error message.

      Supported data types: `Comparable`

      Type Parameters:
        `T` - Value and validator type
      Parameters:
        `compareTo` - Value to compare
      Returns:
        Validator

    - #### lessThan

          static <T extends Comparable<T>> Validator<T> lessThan(T compareTo,
                                                                 Localizable message)

      Build a validator that checks that a value is less than given `compareTo` value, and uses given `Localizable` message as validation error message.

      Supported data types: `Comparable`

      Type Parameters:
        `T` - Value and validator type
      Parameters:
        `compareTo` - Value to compare
        `message` - Validation error message
      Returns:
        Validator

    - #### lessThan

          static <T extends Comparable<T>> Validator<T> lessThan(T compareTo,
                                                                 String message,
                                                                 String messageCode)

      Build a validator that checks that a value is less than given `compareTo` value.

      Supported data types: `Comparable`

      Type Parameters:
        `T` - Value and validator type
      Parameters:
        `compareTo` - Value to compare
        `message` - Validation error message
        `messageCode` - Optional validation error message localization code
      Returns:
        Validator

    - #### lessOrEqual

          static <T extends Comparable<T>> Validator<T> lessOrEqual(T compareTo)

      Build a validator that checks that a value is less than or equal to given `compareTo` value, and uses default `Validator.ValidationMessage.LESS_OR_EQUAL` message as validation error message. Supported data types: `Comparable`.
      Type Parameters:
        `T` - Value and validator type
      Parameters:
        `compareTo` - Value to compare
      Returns:
        Validator

    - #### lessOrEqual

          static <T extends Comparable<T>> Validator<T> lessOrEqual(T compareTo,
                                                                    Localizable message)

      Build a validator that checks that a value is less than or equal to given `compareTo` value, and uses given `Localizable` message as validation error message. Supported data types: `Comparable`.
      Type Parameters:
        `T` - Value and validator type
      Parameters:
        `compareTo` - Value to compare
        `message` - Validation error message
      Returns:
        Validator

    - #### lessOrEqual

          static <T extends Comparable<T>> Validator<T> lessOrEqual(T compareTo,
                                                                    String message,
                                                                    String messageCode)

      Build a validator that checks that a value is less than or equal to given `compareTo` value.

      Supported data types: `Comparable`

      Type Parameters:
        `T` - Value and validator type
      Parameters:
        `compareTo` - Value to compare
        `message` - Validation error message
        `messageCode` - Optional validation error message localization code
      Returns:
        Validator

    - #### greaterThan

          static <T extends Comparable<T>> Validator<T> greaterThan(T compareTo)

      Build a validator that checks that a value is greater than given `compareTo` value, and uses default `Validator.ValidationMessage.LESS_THAN` message as validation error message.

      Supported data types: `Comparable`

      Type Parameters:
        `T` - Value and validator type
      Parameters:
        `compareTo` - Value to compare
      Returns:
        Validator

    - #### greaterThan

          static <T extends Comparable<T>> Validator<T> greaterThan(T compareTo,
                                                                    Localizable message)

      Build a validator that checks that a value is greater than given `compareTo` value, and uses given `Localizable` message as validation error message.

      Supported data types: `Comparable`

      Type Parameters:
        `T` - Value and validator type
      Parameters:
        `compareTo` - Value to compare
        `message` - Validation error message
      Returns:
        Validator

    - #### greaterThan

          static <T extends Comparable<T>> Validator<T> greaterThan(T compareTo,
                                                                    String message,
                                                                    String messageCode)

      Build a validator that checks that a value is greater than given `compareTo` value.

      Supported data types: `Comparable`

      Type Parameters:
        `T` - Value and validator type
      Parameters:
        `compareTo` - Value to compare
        `message` - Validation error message
        `messageCode` - Optional validation error message localization code
      Returns:
        Validator

    - #### greaterOrEqual

          static <T extends Comparable<T>> Validator<T> greaterOrEqual(T compareTo)

      Build a validator that checks that a value is greater than or equal to given `compareTo` value, and uses default `Validator.ValidationMessage.GREATER_OR_EQUAL` message as validation error message. Supported data types: `Comparable`.
      Type Parameters:
        `T` - Value and validator type
      Parameters:
        `compareTo` - Value to compare
      Returns:
        Validator

    - #### greaterOrEqual

          static <T extends Comparable<T>> Validator<T> greaterOrEqual(T compareTo,
                                                                       Localizable message)

      Build a validator that checks that a value is greater than or equal to given `compareTo` value, and uses given `Localizable` message as validation error message. Supported data types: `Comparable`.
      Type Parameters:
        `T` - Value and validator type
      Parameters:
        `compareTo` - Value to compare
        `message` - Validation error message
      Returns:
        Validator

    - #### greaterOrEqual

          static <T extends Comparable<T>> Validator<T> greaterOrEqual(T compareTo,
                                                                       String message,
                                                                       String messageCode)

      Build a validator that checks that a value is greater than or equal to given `compareTo` value.

      Supported data types: `Comparable`

      Type Parameters:
        `T` - Value and validator type
      Parameters:
        `compareTo` - Value to compare
        `message` - Validation error message
        `messageCode` - Optional validation error message localization code
      Returns:
        Validator

    - #### email

          static <T extends CharSequence> Validator<T> email()

      Build a validator that checks that the value is a valid e-mail address using RFC822 format rules, and uses default `Validator.ValidationMessage.EMAIL` message as validation error message.

      Supported data types: `CharSequence`

      Type Parameters:
        `T` - Value and validator type
      Returns:
        Validator

    - #### email

          static <T extends CharSequence> Validator<T> email(Localizable message)

      Build a validator that checks that the value is a valid e-mail address using RFC822 format rules, and uses given `Localizable` message as validation error message.

      Supported data types: `CharSequence`

      Type Parameters:
        `T` - Value and validator type
      Parameters:
        `message` - Validation error message
      Returns:
        Validator

    - #### email

          static <T extends CharSequence> Validator<T> email(String message,
                                                             String messageCode)

      Build a validator that checks that the value is a valid e-mail address using RFC822 format rules.

      Supported data types: `CharSequence`

      Type Parameters:
        `T` - Value and validator type
      Parameters:
        `message` - Validation error message
        `messageCode` - Optional validation error message localization code
      Returns:
        Validator

Copyright © 2017 The Holon Platform. All rights reserved.