Class AbstractValidator<V>

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

public abstract class AbstractValidator<V> extends Object implements Validator<V>
This is the abstract base class all Validator implementations should extend.
Since:
1.0.0
  • Constructor Details

    • AbstractValidator

      public AbstractValidator()
      The constructor.
  • Method Details

    • getId

      public String getId()
      AbstractValidator only provides a default implementation of this method.
      ATTENTION:
      This default implementation returns the simple class name of the actual Validator implementation. This strategy is chosen for simplicity when implementing a new Validator. To ensure stable IDs override this method and return a string constant. This shall at least be done when the name of the class is changed to provide backwards compatibility.
      Specified by:
      getId in interface Validator<V>
      Returns:
      the identifier of this Validator.
      See Also:
    • isDynamic

      public boolean isDynamic()
      This method determines if this Validator is dynamic. Here dynamic means that the validation of the same input may not always return the same validation result (e.g. it holds references to instances that have dynamic impact on the validation).
      Returns:
      true if this Validator is dynamic, false otherwise.
    • getChildCount

      public int getChildCount()
      Specified by:
      getChildCount in interface Composable<V>
    • getChild

      public Validator<?> getChild(int index)
      Specified by:
      getChild in interface Composable<V>
    • source2string

      protected String source2string(Object source)
      Parameters:
      source - the value source.
      Returns:
      the string representation of the given source.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object