public class ResourceBundleConstraintDescriptionResolver extends java.lang.Object implements ConstraintDescriptionResolver
ConstraintDescriptionResolver that resolves constraint descriptions from a
ResourceBundle. The resource bundle's keys are the name of the constraint with
.description appended. For example, the key for the constraint named
javax.validation.constraints.NotNull is
javax.validation.constraints.NotNull.description.
Default descriptions are provided for Bean Validation 1.1's constraints:
Default descriptions are also provided for Hibernate Validator's constraints:
| Constructor and Description |
|---|
ResourceBundleConstraintDescriptionResolver()
Creates a new
ResourceBundleConstraintDescriptionResolver that will resolve
descriptions by looking them up in a resource bundle with the base name
org.springframework.restdocs.constraints.ConstraintDescriptions in the
default locale loaded using the thread context class loader. |
ResourceBundleConstraintDescriptionResolver(java.util.ResourceBundle resourceBundle)
Creates a new
ResourceBundleConstraintDescriptionResolver that will resolve
descriptions by looking them up in the given resourceBundle. |
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
resolveDescription(Constraint constraint)
Resolves the description for the given
constraint. |
public ResourceBundleConstraintDescriptionResolver()
ResourceBundleConstraintDescriptionResolver that will resolve
descriptions by looking them up in a resource bundle with the base name
org.springframework.restdocs.constraints.ConstraintDescriptions in the
default locale loaded using the thread context class loader.public ResourceBundleConstraintDescriptionResolver(java.util.ResourceBundle resourceBundle)
ResourceBundleConstraintDescriptionResolver that will resolve
descriptions by looking them up in the given resourceBundle.resourceBundle - the resource bundlepublic java.lang.String resolveDescription(Constraint constraint)
ConstraintDescriptionResolverconstraint.resolveDescription in interface ConstraintDescriptionResolverconstraint - the constraint