Class ValidatorImpl<T>

java.lang.Object
cdc.validation.ValidatorImpl<T>
All Implemented Interfaces:
Validator<T>

public class ValidatorImpl<T> extends Object implements Validator<T>
  • Constructor Details

    • ValidatorImpl

      public ValidatorImpl(Class<T> valueClass, Checker<? super T> error, Checker<? super T> warning)
  • Method Details

    • createUnchecked

      public static ValidatorImpl<?> createUnchecked(Checker<?> error, Checker<?> warning)
    • getValueClass

      public Class<T> getValueClass()
      Specified by:
      getValueClass in interface Validator<T>
      Returns:
      The class of values validated by this validator.
    • explainError

      public String explainError(String name)
      Description copied from interface: Validator
      Returns an explanation of the rule that must be respected to avoid errors.
      Specified by:
      explainError in interface Validator<T>
      Parameters:
      name - The name that must be given to value in messages.
      Returns:
      An explanation of the rule that must be respected to avoid errors.
    • explainWarning

      public String explainWarning(String name)
      Description copied from interface: Validator
      Returns an explanation of the rule that must be respected to avoid warnings.
      Specified by:
      explainWarning in interface Validator<T>
      Parameters:
      name - The name that must be given to value in messages.
      Returns:
      An explanation of the rule that must be respected to avoid warnings.
    • validate

      public void validate(T value, String name, ValidationHandler handler)
      Description copied from interface: Validator
      Validates a value.
      Specified by:
      validate in interface Validator<T>
      Parameters:
      value - The value.
      name - The name that must be given to value in messages.
      handler - The validation messages handler.
    • getChecker

      public Checker<? super T> getChecker(Validity validity)
    • hasChecker

      public boolean hasChecker(Validity validity)
    • toString

      public String toString()
      Overrides:
      toString in class Object