public class ValidationErrorResourceAssembler extends AbstractResourceAssembler<ValidationError,ValidationErrorResource>
Constructor and Description |
---|
ValidationErrorResourceAssembler(ObjectMapper objectMapper) |
Modifier and Type | Method and Description |
---|---|
protected String |
convertProperty(String propertyName)
Converts the given property name (field name or error code) using the application defined
PropertyNamingStrategy for consistent output in responses. |
void |
toResource(ValidationError validationError,
ValidationErrorResource resource)
Converts the given object into the target resource.
|
instantiateResource, toResource, toResources
public ValidationErrorResourceAssembler(ObjectMapper objectMapper)
public void toResource(ValidationError validationError, ValidationErrorResource resource)
ResourceAssembler
validationError
- the objectresource
- the targetprotected String convertProperty(String propertyName)
PropertyNamingStrategy
for consistent output in responses. The naming strategy is defined in
application.yml
via the spring.jackson.property-naming-strategy
property.
For example, if the PropertyNamingStrategy.SnakeCaseStrategy
is defined,
the following field names and error codes will be translated as following: