Interface Validator<T>

Type Parameters:
T - The type to validate
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface Validator<T>
Validator asserts the validity of a protobuf object.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final Validator
     
    static final Validator
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    assertValid(T proto)
    Asserts validation rules on a protobuf object.
    default boolean
    isValid(T proto)
    Checks validation rules on a protobuf object.
  • Field Details

    • ALWAYS_VALID

      static final Validator ALWAYS_VALID
    • ALWAYS_INVALID

      static final Validator ALWAYS_INVALID
  • Method Details

    • assertValid

      void assertValid(T proto) throws ValidationException
      Asserts validation rules on a protobuf object.
      Parameters:
      proto - the protobuf object to validate.
      Throws:
      ValidationException - with the first validation error encountered.
    • isValid

      default boolean isValid(T proto)
      Checks validation rules on a protobuf object.
      Parameters:
      proto - the protobuf object to validate.
      Returns:
      true if all rules are valid, false if not.