Apply "instance of patten matching" in context and messaging modules
Closes gh-29994
This commit is contained in:
@@ -760,8 +760,8 @@ public class DataBinder implements PropertyEditorRegistry, TypeConverter {
|
||||
* @see #doBind(org.springframework.beans.MutablePropertyValues)
|
||||
*/
|
||||
public void bind(PropertyValues pvs) {
|
||||
MutablePropertyValues mpvs = (pvs instanceof MutablePropertyValues ?
|
||||
(MutablePropertyValues) pvs : new MutablePropertyValues(pvs));
|
||||
MutablePropertyValues mpvs = (pvs instanceof MutablePropertyValues mutablePropertyValues ?
|
||||
mutablePropertyValues : new MutablePropertyValues(pvs));
|
||||
doBind(mpvs);
|
||||
}
|
||||
|
||||
@@ -925,8 +925,8 @@ public class DataBinder implements PropertyEditorRegistry, TypeConverter {
|
||||
BindingResult bindingResult = getBindingResult();
|
||||
// Call each validator with the same binding result
|
||||
for (Validator validator : getValidators()) {
|
||||
if (!ObjectUtils.isEmpty(validationHints) && validator instanceof SmartValidator) {
|
||||
((SmartValidator) validator).validate(target, bindingResult, validationHints);
|
||||
if (!ObjectUtils.isEmpty(validationHints) && validator instanceof SmartValidator smartValidator) {
|
||||
smartValidator.validate(target, bindingResult, validationHints);
|
||||
}
|
||||
else if (validator != null) {
|
||||
validator.validate(target, bindingResult);
|
||||
|
||||
@@ -82,8 +82,8 @@ public abstract class ValidationUtils {
|
||||
"Validator [" + validator.getClass() + "] does not support [" + target.getClass() + "]");
|
||||
}
|
||||
|
||||
if (!ObjectUtils.isEmpty(validationHints) && validator instanceof SmartValidator) {
|
||||
((SmartValidator) validator).validate(target, errors, validationHints);
|
||||
if (!ObjectUtils.isEmpty(validationHints) && validator instanceof SmartValidator smartValidator) {
|
||||
smartValidator.validate(target, errors, validationHints);
|
||||
}
|
||||
else {
|
||||
validator.validate(target, errors);
|
||||
|
||||
Reference in New Issue
Block a user