Class ConstraintDescriptions

java.lang.Object
org.springframework.restdocs.constraints.ConstraintDescriptions

public class ConstraintDescriptions extends Object
Provides access to descriptions of a class's constraints.
Author:
Andy Wilkinson
  • Constructor Details

    • ConstraintDescriptions

      public ConstraintDescriptions(Class<?> clazz)
      Create a new ConstraintDescriptions for the given clazz. Constraints will be resolved using a ValidatorConstraintResolver and descriptions will be resolved using a ResourceBundleConstraintDescriptionResolver.
      Parameters:
      clazz - the class
    • ConstraintDescriptions

      public ConstraintDescriptions(Class<?> clazz, ConstraintResolver constraintResolver)
      Create a new ConstraintDescriptions for the given clazz. Constraints will be resolved using the given constraintResolver and descriptions will be resolved using a ResourceBundleConstraintDescriptionResolver.
      Parameters:
      clazz - the class
      constraintResolver - the constraint resolver
    • ConstraintDescriptions

      public ConstraintDescriptions(Class<?> clazz, ConstraintDescriptionResolver descriptionResolver)
      Create a new ConstraintDescriptions for the given clazz. Constraints will be resolved using a ValidatorConstraintResolver and descriptions will be resolved using the given descriptionResolver.
      Parameters:
      clazz - the class
      descriptionResolver - the description resolver
    • ConstraintDescriptions

      public ConstraintDescriptions(Class<?> clazz, ConstraintResolver constraintResolver, ConstraintDescriptionResolver descriptionResolver)
      Create a new ConstraintDescriptions for the given clazz. Constraints will be resolved using the given constraintResolver and descriptions will be resolved using the given descriptionResolver.
      Parameters:
      clazz - the class
      constraintResolver - the constraint resolver
      descriptionResolver - the description resolver
  • Method Details

    • descriptionsForProperty

      public List<String> descriptionsForProperty(String property)
      Returns a list of the descriptions for the constraints on the given property.
      Parameters:
      property - the property
      Returns:
      the list of constraint descriptions