Enum Class InvariantValidation

java.lang.Object
java.lang.Enum<InvariantValidation>
uk.co.jasonmarston.kiunzi.utility.validator.InvariantValidation
All Implemented Interfaces:
Serializable, Comparable<InvariantValidation>, Constable

public enum InvariantValidation extends Enum<InvariantValidation>
Singleton enum that provides Bean Validation for domain value objects and aggregates.

Use INSTANCE to obtain the single validator and call validate(Object) to check all Bean Validation constraints declared on a domain object. Any constraint violations are collected and re-thrown as a single DomainInvariantViolationException.

See Also:
  • Enum Constant Details

  • Method Details

    • values

      public static InvariantValidation[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static InvariantValidation valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • validate

      public <T> void validate(T valueObject)
      Validates all Bean Validation constraints declared on valueObject.
      Type Parameters:
      T - the type of the object to validate
      Parameters:
      valueObject - the domain object to validate; must not be null
      Throws:
      DomainInvariantViolationException - if one or more constraints are violated