public class ValidationErrorResourceAssembler extends AbstractModelConverter<ValidationError,ValidationErrorResource>
Constructor and Description |
---|
ValidationErrorResourceAssembler(ObjectMapper objectMapper) |
Modifier and Type | Method and Description |
---|---|
void |
convert(ValidationError validationError,
ValidationErrorResource resource)
Converts the given source object into the target object.
|
protected java.lang.String |
convertProperty(java.lang.String propertyName)
Converts the given property name (field name or error code) using the application defined
PropertyNamingStrategy for consistent output in responses. |
convert, convert, instantiateTargetObject
public ValidationErrorResourceAssembler(ObjectMapper objectMapper)
public void convert(ValidationError validationError, ValidationErrorResource resource)
ModelConverter
validationError
- the source objectresource
- the target objectprotected java.lang.String convertProperty(java.lang.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: