public class ResourceBundleConstraintDescriptionResolver extends 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(ResourceBundle resourceBundle)
Creates a new
ResourceBundleConstraintDescriptionResolver that will resolve
descriptions by looking them up in the given resourceBundle . |
Modifier and Type | Method and Description |
---|---|
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(ResourceBundle resourceBundle)
ResourceBundleConstraintDescriptionResolver
that will resolve
descriptions by looking them up in the given resourceBundle
.resourceBundle
- the resource bundlepublic String resolveDescription(Constraint constraint)
ConstraintDescriptionResolver
constraint
.resolveDescription
in interface ConstraintDescriptionResolver
constraint
- the constraint