diff --git a/spring-context/src/main/java/org/springframework/validation/BindException.java b/spring-context/src/main/java/org/springframework/validation/BindException.java index bc30e9aea2ab..7e291f847c6b 100644 --- a/spring-context/src/main/java/org/springframework/validation/BindException.java +++ b/spring-context/src/main/java/org/springframework/validation/BindException.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2018 the original author or authors. + * Copyright 2002-2020 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -58,7 +58,7 @@ public BindException(BindingResult bindingResult) { /** * Create a new BindException instance for a target bean. - * @param target target bean to bind onto + * @param target the target bean to bind onto * @param objectName the name of the target object * @see BeanPropertyBindingResult */ @@ -70,8 +70,6 @@ public BindException(Object target, String objectName) { /** * Return the BindingResult that this BindException wraps. - * Will typically be a BeanPropertyBindingResult. - * @see BeanPropertyBindingResult */ public final BindingResult getBindingResult() { return this.bindingResult; @@ -231,6 +229,7 @@ public Class getFieldType(String field) { } @Override + @Nullable public Object getTarget() { return this.bindingResult.getTarget(); } diff --git a/spring-context/src/main/java/org/springframework/validation/MapBindingResult.java b/spring-context/src/main/java/org/springframework/validation/MapBindingResult.java index cadd9f8b573c..41860a4c1d42 100644 --- a/spring-context/src/main/java/org/springframework/validation/MapBindingResult.java +++ b/spring-context/src/main/java/org/springframework/validation/MapBindingResult.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2020 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,6 +19,7 @@ import java.io.Serializable; import java.util.Map; +import org.springframework.lang.NonNull; import org.springframework.lang.Nullable; import org.springframework.util.Assert; @@ -52,11 +53,15 @@ public MapBindingResult(Map target, String objectName) { } + /** + * Return the target Map to bind onto. + */ public final Map getTargetMap() { return this.target; } @Override + @NonNull public final Object getTarget() { return this.target; } diff --git a/spring-web/src/main/java/org/springframework/web/bind/support/WebExchangeBindException.java b/spring-web/src/main/java/org/springframework/web/bind/support/WebExchangeBindException.java index 2da9e414ab7e..ccb49da9f6b6 100644 --- a/spring-web/src/main/java/org/springframework/web/bind/support/WebExchangeBindException.java +++ b/spring-web/src/main/java/org/springframework/web/bind/support/WebExchangeBindException.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2018 the original author or authors. + * Copyright 2002-2020 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -217,6 +217,7 @@ public Class getFieldType(String field) { } @Override + @Nullable public Object getTarget() { return this.bindingResult.getTarget(); }