Interface Validator<T>

All Superinterfaces:
Serializable
All Known Subinterfaces:
EntityValidator

public interface Validator<T> extends Serializable
Provides information about constraints on an attribute.
NOT USED
Since:
5.2.210803
  • Method Summary

    Modifier and Type
    Method
    Description
    checkValidity(Entity owner, Attribute<T> attribute, T value)
    Check the validity of the given value against this constraint.
    boolean
    Returns whether or not a null value is allowed.
    boolean
    isValid(T value)
    Check the validity of the given value against this constraint.
  • Method Details

    • isValid

      boolean isValid(@Nullable T value)
      Check the validity of the given value against this constraint.
      Returns:
      true if no constraint is violated, else false.
      Since:
      5.2.210803
    • checkValidity

      T checkValidity(Entity owner, Attribute<T> attribute, T value) throws IllegalArgumentException
      Check the validity of the given value against this constraint. The constraint may choose to modify the value or return a corrected value.
      Parameters:
      owner - the entity where the value should be set
      attribute - the owning attribute where this constraints belongs to
      value - the value which should be set
      Returns:
      the value itself or corrected value which then will be used to update the entity
      Throws:
      IllegalArgumentException - when a constraint is violated. The exception message contains a descriptive explanation.
      Since:
      5.2.210803
    • isNullAllowed

      boolean isNullAllowed()
      Returns whether or not a null value is allowed.
      Returns:
      true if a null value is allowed, false otherwise.
      Since:
      5.2.210803