Top Description Inners Fields Constructors Methods
org.springframework.validation.beanvalidation

public Class SpringValidatorAdapter

extends Object
implements SmartValidator, Validator
Class Inheritance
All Implemented Interfaces
jakarta.validation.Validator, org.springframework.validation.SmartValidator, org.springframework.validation.Validator
Known Direct Subclasses
org.springframework.validation.beanvalidation.CustomValidatorBean, org.springframework.validation.beanvalidation.LocalValidatorFactoryBean
Imports
java.io.Serializable, java.util.ArrayList, .LinkedHashSet, .List, .Map, .Set, .TreeMap, jakarta.validation.ConstraintViolation, .ElementKind, .Path, .ValidationException, jakarta.validation.executable.ExecutableValidator, jakarta.validation.metadata.BeanDescriptor, .ConstraintDescriptor, org.springframework.beans.InvalidPropertyException, .NotReadablePropertyException, org.springframework.context.MessageSourceResolvable, org.springframework.context.support.DefaultMessageSourceResolvable, org.springframework.lang.Nullable, org.springframework.util.Assert, .ClassUtils, .StringUtils, org.springframework.validation.BindingResult, .Errors, .FieldError, .ObjectError, .SmartValidator

Adapter that takes a JSR-303 javax.validator.Validator and exposes it as a Spring org.springframework.validation.Validator while also exposing the original JSR-303 Validator interface itself.

Can be used as a programmatic wrapper. Also serves as base class for CustomValidatorBean and LocalValidatorFactoryBean, and as the primary implementation of the SmartValidator interface.

As of Spring Framework 5.0, this adapter is fully compatible with Bean Validation 1.1 as well as 2.0.

Authors
Juergen Hoeller, Sam Brannen
Since
3.0
See Also
SmartValidator, CustomValidatorBean, LocalValidatorFactoryBean

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
SpringValidatorAdapter.ResolvableAttribute

Wrapper for a String attribute which can be resolved via a MessageSource, falling back to the original attribute as a default value otherwise.

private static class
SpringValidatorAdapter.ViolationFieldError

Subclass of FieldError with Spring-style default message rendering.

private static class
SpringValidatorAdapter.ViolationObjectError

Subclass of ObjectError with Spring-style default message rendering.

Field Summary

Modifier and TypeField and Description
private static final Set<String>
private Validator

Constructor Summary

AccessConstructor and Description
public
SpringValidatorAdapter(Validator
the JSR-303 Validator to wrap
targetValidator
)

Create a new SpringValidatorAdapter for the given JSR-303 Validator.

pack-priv

Method Summary

Modifier and TypeMethod and Description
private Class<?>[]
asValidationGroups(Object... validationHints)

Turn the specified validation hints into JSR-303 validation groups.

private static boolean
protected String

Returns:

a corresponding error code (for use with Errors)
determineErrorCode
(ConstraintDescriptor<?>
the JSR-303 ConstraintDescriptor for the current violation
descriptor
)

Determine a Spring-reported error code for the given constraint descriptor.

protected String

Returns:

the Spring-reported field (for use with Errors)
determineField
(ConstraintViolation<Object>
the current JSR-303 ConstraintViolation
violation
)

Determine a field for the given constraint violation.

public ExecutableValidator
forExecutables()

Implements jakarta.validation.Validator.forExecutables.

Returns the contract for validating parameters and return values of methods and constructors.

protected Object[]

Returns:

the Object array that represents the FieldError arguments
getArgumentsForConstraint
(String
the name of the target object
objectName
,
String
the field that caused the binding error
field
,
ConstraintDescriptor<?>
the JSR-303 constraint descriptor
descriptor
)

Return FieldError arguments for a validation error on the given field.

public BeanDescriptor
getConstraintsForClass(Class<?>
class or interface type evaluated
clazz
)

Implements jakarta.validation.Validator.getConstraintsForClass.

Returns the descriptor object describing bean constraints.

protected Object

Returns:

the invalid value to expose as part of the field error
getRejectedValue
(String
the field that caused the binding error
field
,
ConstraintViolation<Object>
the corresponding JSR-303 ConstraintViolation
violation
,
BindingResult
a Spring BindingResult for the backing object which contains the current field's value
bindingResult
)

Extract the rejected value behind the given constraint violation, for exposure through the Spring errors representation.

protected MessageSourceResolvable

Returns:

a corresponding MessageSourceResolvable for the specified field
getResolvableField
(String
the name of the target object
objectName
,
String
the field that caused the binding error
field
)

Build a resolvable wrapper for the specified field, allowing to resolve the field's name in a MessageSource.

protected void
processConstraintViolations(Set<ConstraintViolation<Object>>
the JSR-303 ConstraintViolation results
violations
,
Errors
the Spring errors object to register to
errors
)

Process the given JSR-303 ConstraintViolations, adding corresponding errors to the provided Spring Errors object.

protected boolean

Returns:

true if java.text.MessageFormat is to be applied, or false if the violation's message should be used as-is
requiresMessageFormat
(ConstraintViolation<?>
the Bean Validation constraint violation, including BV-defined interpolation of named attribute references in its message
violation
)

Indicate whether this violation's interpolated message has remaining placeholders and therefore requires java.text.MessageFormat to be applied to it.

pack-priv void
setTargetValidator(Validator targetValidator)

public boolean
supports(Class<?>
the Class that this Validator is being asked if it can validate
clazz
)

Implements org.springframework.validation.Validator.supports.

Can this Validator validate instances of the supplied clazz?

public <T> T
unwrap(Class<T>
the class of the object to return
type
)

Overrides default org.springframework.validation.SmartValidator.unwrap.

Implements jakarta.validation.Validator.unwrap.

Return a contained validator instance of the specified type, unwrapping as far as necessary.

public void
validate(Object
the object that is to be validated
target
,
Errors
contextual state about the validation process
errors
)

Implements org.springframework.validation.Validator.validate.

Validate the given target object which must be of a Class for which the supports(Class) method typically has returned (or would return) true.

public void
validate(Object
the object that is to be validated
target
,
Errors
contextual state about the validation process
errors
,
Object...
one or more hint objects to be passed to the validation engine
validationHints
)

Implements org.springframework.validation.SmartValidator.validate.

Validate the supplied target object, which must be of a type of Class for which the supports(Class) method typically returns true.

public <T> Set<ConstraintViolation<T>>
validate(T
object to validate
object
,
Class<?>...
the group or list of groups targeted for validation (defaults to Default)
groups
)

Implements jakarta.validation.Validator.validate.

Validates all constraints on object.

public <T> Set<ConstraintViolation<T>>
validateProperty(T
object to validate
object
,
String
property to validate (i.e. field and getter constraints)
propertyName
,
Class<?>...
the group or list of groups targeted for validation (defaults to Default)
groups
)

Implements jakarta.validation.Validator.validateProperty.

Validates all constraints placed on the property of object named propertyName.

public void
validateValue(Class<?>
the target type
targetType
,
String
the name of the field
fieldName
,
Object
the candidate value
value
,
Errors
contextual state about the validation process
errors
,
Object...
one or more hint objects to be passed to the validation engine
validationHints
)

Overrides default org.springframework.validation.SmartValidator.validateValue.

Validate the supplied value for the specified field on the target type, reporting the same validation errors as if the value would be bound to the field on an instance of the target class.

public <T> Set<ConstraintViolation<T>>
validateValue(Class<T>
the bean type
beanType
,
String
property to validate
propertyName
,
Object
property value to validate
value
,
Class<?>...
the group or list of groups targeted for validation (defaults to Default).
groups
)

Implements jakarta.validation.Validator.validateValue.

Validates all constraints placed on the property named propertyName of the class beanType would the property value be value.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

internalAnnotationAttributesback to summary
private static final Set<String> internalAnnotationAttributes
targetValidatorback to summary
private Validator targetValidator
Annotations
@Nullable

Constructor Detail

SpringValidatorAdapterback to summary
public SpringValidatorAdapter(Validator targetValidator)

Create a new SpringValidatorAdapter for the given JSR-303 Validator.

Parameters
targetValidator:Validator

the JSR-303 Validator to wrap

SpringValidatorAdapterback to summary
pack-priv SpringValidatorAdapter()

Method Detail

asValidationGroupsback to summary
private Class<?>[] asValidationGroups(Object... validationHints)

Turn the specified validation hints into JSR-303 validation groups.

Since
5.1
containsSpringStylePlaceholderback to summary
private static boolean containsSpringStylePlaceholder(String message)
determineErrorCodeback to summary
protected String determineErrorCode(ConstraintDescriptor<?> descriptor)

Determine a Spring-reported error code for the given constraint descriptor.

The default implementation returns the simple class name of the descriptor's annotation type. Note that the configured org.springframework.validation.MessageCodesResolver will automatically generate error code variations which include the object name and the field name.

Parameters
descriptor:ConstraintDescriptor<?>

the JSR-303 ConstraintDescriptor for the current violation

Returns:String

a corresponding error code (for use with Errors)

Since
4.2
See Also
jakarta.validation.metadata.ConstraintDescriptor#getAnnotation(), org.springframework.validation.MessageCodesResolver
determineFieldback to summary
protected String determineField(ConstraintViolation<Object> violation)

Determine a field for the given constraint violation.

The default implementation returns the stringified property path.

Parameters
violation:ConstraintViolation<Object>

the current JSR-303 ConstraintViolation

Returns:String

the Spring-reported field (for use with Errors)

Since
4.2
See Also
jakarta.validation.ConstraintViolation#getPropertyPath(), org.springframework.validation.FieldError#getField()
forExecutablesback to summary
public ExecutableValidator forExecutables()

Implements jakarta.validation.Validator.forExecutables.

Doc from jakarta.validation.Validator.forExecutables.

Returns the contract for validating parameters and return values of methods and constructors.

Returns:ExecutableValidator

contract for method and constructor validation

Annotations
@Override
getArgumentsForConstraintback to summary
protected Object[] getArgumentsForConstraint(String objectName, String field, ConstraintDescriptor<?> descriptor)

Return FieldError arguments for a validation error on the given field. Invoked for each violated constraint.

The default implementation returns a first argument indicating the field name (see getResolvableField). Afterwards, it adds all actual constraint annotation attributes (i.e. excluding "message", "groups" and "payload") in alphabetical order of their attribute names.

Can be overridden to e.g. add further attributes from the constraint descriptor.

Parameters
objectName:String

the name of the target object

field:String

the field that caused the binding error

descriptor:ConstraintDescriptor<?>

the JSR-303 constraint descriptor

Returns:Object[]

the Object array that represents the FieldError arguments

See Also
org.springframework.validation.FieldError#getArguments, org.springframework.context.support.DefaultMessageSourceResolvable, org.springframework.validation.DefaultBindingErrorProcessor#getArgumentsForBindError
getConstraintsForClassback to summary
public BeanDescriptor getConstraintsForClass(Class<?> clazz)

Implements jakarta.validation.Validator.getConstraintsForClass.

Doc from jakarta.validation.Validator.getConstraintsForClass.

Returns the descriptor object describing bean constraints.

The returned object (and associated objects including ConstraintDescriptors) are immutable.

Parameters
clazz:Class<?>

class or interface type evaluated

Returns:BeanDescriptor

the bean descriptor for the specified class

Annotations
@Override
getRejectedValueback to summary
protected Object getRejectedValue(String field, ConstraintViolation<Object> violation, BindingResult bindingResult)

Extract the rejected value behind the given constraint violation, for exposure through the Spring errors representation.

Parameters
field:String

the field that caused the binding error

violation:ConstraintViolation<Object>

the corresponding JSR-303 ConstraintViolation

bindingResult:BindingResult

a Spring BindingResult for the backing object which contains the current field's value

Returns:Object

the invalid value to expose as part of the field error

Annotations
@Nullable
Since
4.2
See Also
jakarta.validation.ConstraintViolation#getInvalidValue(), org.springframework.validation.FieldError#getRejectedValue()
getResolvableFieldback to summary
protected MessageSourceResolvable getResolvableField(String objectName, String field)

Build a resolvable wrapper for the specified field, allowing to resolve the field's name in a MessageSource.

The default implementation returns a first argument indicating the field: of type DefaultMessageSourceResolvable, with "objectName.field" and "field" as codes, and with the plain field name as default message.

Parameters
objectName:String

the name of the target object

field:String

the field that caused the binding error

Returns:MessageSourceResolvable

a corresponding MessageSourceResolvable for the specified field

Since
4.3
See Also
getArgumentsForConstraint
processConstraintViolationsback to summary
protected void processConstraintViolations(Set<ConstraintViolation<Object>> violations, Errors errors)

Process the given JSR-303 ConstraintViolations, adding corresponding errors to the provided Spring Errors object.

Parameters
violations:Set<ConstraintViolation<Object>>

the JSR-303 ConstraintViolation results

errors:Errors

the Spring errors object to register to

Annotations
@SuppressWarnings:serial
requiresMessageFormatback to summary
protected boolean requiresMessageFormat(ConstraintViolation<?> violation)

Indicate whether this violation's interpolated message has remaining placeholders and therefore requires java.text.MessageFormat to be applied to it. Called for a Bean Validation defined message (coming out ValidationMessages.properties) when rendered as the default message in Spring's MessageSource.

The default implementation considers a Spring-style "{0}" placeholder for the field name as an indication for java.text.MessageFormat. Any other placeholder or escape syntax occurrences are typically a mismatch, coming out of regex pattern values or the like. Note that standard Bean Validation does not support "{0}" style placeholders at all; this is a feature typically used in Spring MessageSource resource bundles.

Parameters
violation:ConstraintViolation<?>

the Bean Validation constraint violation, including BV-defined interpolation of named attribute references in its message

Returns:boolean

true if java.text.MessageFormat is to be applied, or false if the violation's message should be used as-is

Since
5.1.8
See Also
getArgumentsForConstraint
setTargetValidatorback to summary
pack-priv void setTargetValidator(Validator targetValidator)
supportsback to summary
public boolean supports(Class<?> clazz)

Implements org.springframework.validation.Validator.supports.

Doc from org.springframework.validation.Validator.supports.

Can this Validator validate instances of the supplied clazz?

This method is typically implemented like so:

return Foo.class.isAssignableFrom(clazz);
(Where Foo is the class (or superclass) of the actual object instance that is to be validated.)
Parameters
clazz:Class<?>

the Class that this Validator is being asked if it can validate

Returns:boolean

true if this Validator can indeed validate instances of the supplied clazz

Annotations
@Override
unwrapback to summary
public <T> T unwrap(Class<T> type)

Overrides default org.springframework.validation.SmartValidator.unwrap.

Implements jakarta.validation.Validator.unwrap.

Doc from org.springframework.validation.SmartValidator.unwrap.

Return a contained validator instance of the specified type, unwrapping as far as necessary.

Parameters
<T>
the type of the object to return
type:Class<T>

the class of the object to return

Returns:T

a validator instance of the specified type; null if there isn't a nested validator; an exception may be raised if the specified validator type does not match.

Annotations
@Override
@SuppressWarnings:unchecked
validateback to summary
public void validate(Object target, Errors errors)

Implements org.springframework.validation.Validator.validate.

Doc from org.springframework.validation.Validator.validate.

Validate the given target object which must be of a Class for which the supports(Class) method typically has returned (or would return) true.

The supplied errors instance can be used to report any resulting validation errors, typically as part of a larger binding process which this validator is meant to participate in. Binding errors have typically been pre-registered with the errors instance before this invocation already.

Parameters
target:Object

the object that is to be validated

errors:Errors

contextual state about the validation process

Annotations
@Override
validateback to summary
public void validate(Object target, Errors errors, Object... validationHints)

Implements org.springframework.validation.SmartValidator.validate.

Doc from org.springframework.validation.SmartValidator.validate.

Validate the supplied target object, which must be of a type of Class for which the supports(Class) method typically returns true.

The supplied errors instance can be used to report any resulting validation errors.

This variant of validate() supports validation hints, such as validation groups against a JSR-303 provider (in which case, the provided hint objects need to be annotation arguments of type Class).

Note

Validation hints may get ignored by the actual target Validator, in which case this method should behave just like its regular validate(Object, Errors) sibling.

Parameters
target:Object

the object that is to be validated

errors:Errors

contextual state about the validation process

validationHints:Object[]

one or more hint objects to be passed to the validation engine

Annotations
@Override
validateback to summary
public <T> Set<ConstraintViolation<T>> validate(T object, Class<?>... groups)

Implements jakarta.validation.Validator.validate.

Doc from jakarta.validation.Validator.validate.

Validates all constraints on object.

Parameters
<T>
the type of the object to validate
object:T

object to validate

groups:Class<?>[]

the group or list of groups targeted for validation (defaults to Default)

Returns:Set<ConstraintViolation<T>>

constraint violations or an empty set if none

Annotations
@Override
validatePropertyback to summary
public <T> Set<ConstraintViolation<T>> validateProperty(T object, String propertyName, Class<?>... groups)

Implements jakarta.validation.Validator.validateProperty.

Doc from jakarta.validation.Validator.validateProperty.

Validates all constraints placed on the property of object named propertyName.

Parameters
<T>
the type of the object to validate
object:T

object to validate

propertyName:String

property to validate (i.e. field and getter constraints)

groups:Class<?>[]

the group or list of groups targeted for validation (defaults to Default)

Returns:Set<ConstraintViolation<T>>

constraint violations or an empty set if none

Annotations
@Override
validateValueback to summary
public void validateValue(Class<?> targetType, String fieldName, Object value, Errors errors, Object... validationHints)

Overrides default org.springframework.validation.SmartValidator.validateValue.

Doc from org.springframework.validation.SmartValidator.validateValue.

Validate the supplied value for the specified field on the target type, reporting the same validation errors as if the value would be bound to the field on an instance of the target class.

Parameters
targetType:Class<?>

the target type

fieldName:String

the name of the field

value:Object

the candidate value

errors:Errors

contextual state about the validation process

validationHints:Object[]

one or more hint objects to be passed to the validation engine

Annotations
@SuppressWarnings:rawtypes, unchecked
@Override
validateValueback to summary
public <T> Set<ConstraintViolation<T>> validateValue(Class<T> beanType, String propertyName, Object value, Class<?>... groups)

Implements jakarta.validation.Validator.validateValue.

Doc from jakarta.validation.Validator.validateValue.

Validates all constraints placed on the property named propertyName of the class beanType would the property value be value.

ConstraintViolation objects return null for ConstraintViolation#getRootBean() and ConstraintViolation#getLeafBean().

Parameters
<T>
the type of the object to validate
beanType:Class<T>

the bean type

propertyName:String

property to validate

value:Object

property value to validate

groups:Class<?>[]

the group or list of groups targeted for validation (defaults to Default).

Returns:Set<ConstraintViolation<T>>

constraint violations or an empty set if none

Annotations
@Override
org.springframework.validation.beanvalidation back to summary

private Class SpringValidatorAdapter.ResolvableAttribute

extends Object
implements MessageSourceResolvable, Serializable
Class Inheritance
  • java.lang.Object
  • org.springframework.validation.beanvalidation.SpringValidatorAdapter.ResolvableAttribute
All Implemented Interfaces
java.io.Serializable, org.springframework.context.MessageSourceResolvable
Annotations
@SuppressWarnings:serial

Wrapper for a String attribute which can be resolved via a MessageSource, falling back to the original attribute as a default value otherwise.

Field Summary

Modifier and TypeField and Description
private final String

Constructor Summary

AccessConstructor and Description
public
ResolvableAttribute(String resolvableString)

Method Summary

Modifier and TypeMethod and Description
public Object[]
getArguments()

Overrides default org.springframework.context.MessageSourceResolvable.getArguments.

Return the array of arguments to be used to resolve this message.

public String[]
getCodes()

Implements org.springframework.context.MessageSourceResolvable.getCodes.

Return the codes to be used to resolve this message, in the order that they should get tried.

public String
getDefaultMessage()

Overrides default org.springframework.context.MessageSourceResolvable.getDefaultMessage.

Return the default message to be used to resolve this message.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

resolvableStringback to summary
private final String resolvableString

Constructor Detail

ResolvableAttributeback to summary
public ResolvableAttribute(String resolvableString)

Method Detail

getArgumentsback to summary
public Object[] getArguments()

Overrides default org.springframework.context.MessageSourceResolvable.getArguments.

Doc from org.springframework.context.MessageSourceResolvable.getArguments.

Return the array of arguments to be used to resolve this message.

The default implementation simply returns null.

Returns:Object[]

an array of objects to be used as parameters to replace placeholders within the message text

Annotations
@Override
@Nullable
getCodesback to summary
public String[] getCodes()

Implements org.springframework.context.MessageSourceResolvable.getCodes.

Doc from org.springframework.context.MessageSourceResolvable.getCodes.

Return the codes to be used to resolve this message, in the order that they should get tried. The last code will therefore be the default one.

Returns:String[]

a String array of codes which are associated with this message

Annotations
@Override
getDefaultMessageback to summary
public String getDefaultMessage()

Overrides default org.springframework.context.MessageSourceResolvable.getDefaultMessage.

Doc from org.springframework.context.MessageSourceResolvable.getDefaultMessage.

Return the default message to be used to resolve this message.

The default implementation simply returns null. Note that the default message may be identical to the primary message code (getCodes()), which effectively enforces org.springframework.context.support.AbstractMessageSource#setUseCodeAsDefaultMessage for this particular message.

Returns:String

the default message, or null if no default

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override
org.springframework.validation.beanvalidation back to summary

private Class SpringValidatorAdapter.ViolationFieldError

extends FieldError
implements Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable
Annotations
@SuppressWarnings:serial

Subclass of FieldError with Spring-style default message rendering.

Field Summary

Modifier and TypeField and Description
private transient SpringValidatorAdapter
private transient ConstraintViolation<?>

Constructor Summary

AccessConstructor and Description
public
ViolationFieldError(String objectName, String field, Object rejectedValue, String[] codes, Object[] arguments, ConstraintViolation<?> violation, SpringValidatorAdapter adapter)

Method Summary

Modifier and TypeMethod and Description
public boolean
shouldRenderDefaultMessage()

Overrides org.springframework.context.support.DefaultMessageSourceResolvable.shouldRenderDefaultMessage.

Indicate whether the specified default message needs to be rendered for substituting placeholders and/or java.text.MessageFormat escaping.

Inherited from org.springframework.validation.FieldError:
equalsgetFieldgetRejectedValuehashCodeisBindingFailuretoString

Field Detail

adapterback to summary
private transient SpringValidatorAdapter adapter
Annotations
@Nullable
violationback to summary
private transient ConstraintViolation<?> violation
Annotations
@Nullable

Constructor Detail

ViolationFieldErrorback to summary
public ViolationFieldError(String objectName, String field, Object rejectedValue, String[] codes, Object[] arguments, ConstraintViolation<?> violation, SpringValidatorAdapter adapter)

Method Detail

shouldRenderDefaultMessageback to summary
public boolean shouldRenderDefaultMessage()

Overrides org.springframework.context.support.DefaultMessageSourceResolvable.shouldRenderDefaultMessage.

Doc from org.springframework.context.support.DefaultMessageSourceResolvable.shouldRenderDefaultMessage.

Indicate whether the specified default message needs to be rendered for substituting placeholders and/or java.text.MessageFormat escaping.

Returns:boolean

true if the default message may contain argument placeholders; false if it definitely does not contain placeholders or custom escaping and can therefore be simply exposed as-is

Annotations
@Override
org.springframework.validation.beanvalidation back to summary

private Class SpringValidatorAdapter.ViolationObjectError

extends ObjectError
implements Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable
Annotations
@SuppressWarnings:serial

Subclass of ObjectError with Spring-style default message rendering.

Field Summary

Modifier and TypeField and Description
private transient SpringValidatorAdapter
private transient ConstraintViolation<?>

Constructor Summary

AccessConstructor and Description
public
ViolationObjectError(String objectName, String[] codes, Object[] arguments, ConstraintViolation<?> violation, SpringValidatorAdapter adapter)

Method Summary

Modifier and TypeMethod and Description
public boolean
shouldRenderDefaultMessage()

Overrides org.springframework.context.support.DefaultMessageSourceResolvable.shouldRenderDefaultMessage.

Indicate whether the specified default message needs to be rendered for substituting placeholders and/or java.text.MessageFormat escaping.

Inherited from org.springframework.validation.ObjectError:
containsequalsgetObjectNamehashCodetoStringunwrapwrap

Field Detail

adapterback to summary
private transient SpringValidatorAdapter adapter
Annotations
@Nullable
violationback to summary
private transient ConstraintViolation<?> violation
Annotations
@Nullable

Constructor Detail

ViolationObjectErrorback to summary
public ViolationObjectError(String objectName, String[] codes, Object[] arguments, ConstraintViolation<?> violation, SpringValidatorAdapter adapter)

Method Detail

shouldRenderDefaultMessageback to summary
public boolean shouldRenderDefaultMessage()

Overrides org.springframework.context.support.DefaultMessageSourceResolvable.shouldRenderDefaultMessage.

Doc from org.springframework.context.support.DefaultMessageSourceResolvable.shouldRenderDefaultMessage.

Indicate whether the specified default message needs to be rendered for substituting placeholders and/or java.text.MessageFormat escaping.

Returns:boolean

true if the default message may contain argument placeholders; false if it definitely does not contain placeholders or custom escaping and can therefore be simply exposed as-is

Annotations
@Override