Class AbstractValidator<T>

java.lang.Object
ch.tocco.nice2.model.base.unmarshal.validate.AbstractValidator<T>
All Implemented Interfaces:
Validator
Direct Known Subclasses:
AbstractNumberValidator, LengthValidator, RegexValidator

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

    • AbstractValidator

      protected AbstractValidator()
  • Method Details

    • validate

      public String validate(Object value, String param, String msg, boolean negate)
      Description copied from interface: Validator
      Validate a value. The converted value will be passed to this method.
      Specified by:
      validate in interface Validator
      Parameters:
      value - The value to be validated.
      param - The parameter passed to the validator.
      msg - The custom error message or null, if none was specified.
      negate - true, if the validation should be negated.
      Returns:
      An error message (where '{1}' denotes where to put a description of the element) or null, if the value is valid.
    • validate

      protected abstract boolean validate(T value, String param)
    • getNormalMessage

      protected abstract String getNormalMessage(T value, String param)
    • getNegatedMessage

      protected abstract String getNegatedMessage(T value, String param)
    • invalidMapping

      protected InvalidMappingException invalidMapping(String msg)
    • invalidMapping

      protected InvalidMappingException invalidMapping(String msg, Throwable cause)