Interface Validator<V>

    • Method Detail

      • validate

        default ValidationResult validate​(V value)
        This method validates the given value.
        Parameters:
        value - is the value to validate.
        Returns:
        the ValidationResult or null if the given value is valid according to this Validator.
      • validate

        ValidationResult validate​(V value,
                                  Object valueSource)
        This method validates the given value.
        Parameters:
        value - is the value to validate.
        valueSource - is the source describing the origin of the given value. The source needs to have a reasonable string-representation as this may be displayed to the end-user to locate the source of the failure. In most cases it is suitable to directly pass a String.
        Returns:
        the ValidationResult.
      • isMandatory

        default boolean isMandatory()
        Returns:
        true if this is a validator for mandatory fields (that will not accept null or empty values), false otherwise.
      • getMin

        default Object getMin()
        Returns:
        the minimum allowed value. Typically of type <V> but this can not be guaranteed.
      • getMax

        default Object getMax()
        Returns:
        the maximum allowed value. Typically of type <V> but this can not be guaranteed.
      • isValidating

        static boolean isValidating​(Validator<?> validator)
        Parameters:
        validator - the Validator to check. May be null.
        Returns:
        true if the given Validator is neither null nor none, false otherwise.