Class AbstractValueValidator<V>

java.lang.Object
io.github.mmm.validation.AbstractValidator<V>
io.github.mmm.validation.AbstractValueValidator<V>
Type Parameters:
V - type of the value to validate.
All Implemented Interfaces:
Composable<Validator<?>>, Validator<V>, Iterable<Validator<?>>

public abstract class AbstractValueValidator<V> extends AbstractValidator<V>
This is the abstract base implementation of Validator.
Since:
1.0.0
  • Constructor Details

    • AbstractValueValidator

      public AbstractValueValidator()
      The constructor.
  • Method Details

    • validate

      public ValidationResult validate(V value, Object valueSource)
      Description copied from interface: Validator
      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.
    • validateNull

      protected Localizable validateNull()
      This method performs the validation in case null was provided as value. By default null should be considered as a legal value. Only for validators such as mandatory validator this method should be overridden.
      Returns:
      the failure message or null if null is valid.
    • validateNotNull

      protected abstract Localizable validateNotNull(V value)
      This method performs the validation in case value is NOT null. This method contains the actual custom logic for the validation. It is therefore designed in a way that makes it most simple to implement custom validators.
      Parameters:
      value - the value to validate.
      Returns:
      the failure message or null if the the given value is valid.