Interface PropertyAssert<SELF extends PropertyAssert<SELF,ACTUAL>,ACTUAL>

Type Parameters:
SELF - self type parameter
ACTUAL - actual type parameter
All Superinterfaces:
Assert<SELF,ACTUAL>, Descriptable<SELF>, ExtensionPoints<SELF,ACTUAL>, ValidationAssert<SELF,ACTUAL,Validator>
All Known Subinterfaces:
BeanAssert<SELF,ACTUAL>
All Known Implementing Classes:
AbstractBeanAssert, AbstractPropertyAssert

public interface PropertyAssert<SELF extends PropertyAssert<SELF,ACTUAL>,ACTUAL> extends ValidationAssert<SELF,ACTUAL,Validator>
An interface for verifying values against properties of bean types.
Author:
Jin Kwon <onacit_at_gmail.com>
  • Method Details

    • isValidFor

      <T> SELF isValidFor(Class<T> beanType, String propertyName, Consumer<? super ConstraintViolation<T>> consumer)
      Verifies that the actual value is valid for the property of specified name of specified bean type while accepting constraint violations, if any populated, to specified consumer.
      Type Parameters:
      T - type of the object to validate
      Parameters:
      beanType - the bean type; not null.
      propertyName - the name of the property to validate; not null.
      consumer - the consumer accepts constraint violations; not null.
      Returns:
      this assertion object.
      Throws:
      AssertionError - when the actual is null or is not valid for beanType#propertyName.
      See Also:
    • isValidFor

      default <T> SELF isValidFor(Class<T> beanType, String propertyName)
      Verifies that the actual value is valid for the property of specified name of specified bean type.
      Type Parameters:
      T - type of the object to validate
      Parameters:
      beanType - the bean type; not null.
      propertyName - the name of the property to validate; not null.
      Returns:
      this assertion object.
      Throws:
      AssertionError - when the actual is null or is not valid for beanType#propertyName.
      API Note:
      Note that the @Valid is not honored by the Validator.validateValue(Class, String, Object, Class[]) method on which this method relies.
      Implementation Note:
      This method invokes isValidFor(Class, String, Consumer) method with beanType, propertyName, and a consumer does nothing.