Explicit nullability declarations for getTarget() implementations

This commit is contained in:
Juergen Hoeller
2020-09-01 23:31:00 +02:00
parent c9573a4fb6
commit b0b4b47bae
3 changed files with 11 additions and 6 deletions

View File

@@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -58,7 +58,7 @@ public class BindException extends Exception implements BindingResult {
/** /**
* Create a new BindException instance for a target bean. * 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 * @param objectName the name of the target object
* @see BeanPropertyBindingResult * @see BeanPropertyBindingResult
*/ */
@@ -70,8 +70,6 @@ public class BindException extends Exception implements BindingResult {
/** /**
* Return the BindingResult that this BindException wraps. * Return the BindingResult that this BindException wraps.
* Will typically be a BeanPropertyBindingResult.
* @see BeanPropertyBindingResult
*/ */
public final BindingResult getBindingResult() { public final BindingResult getBindingResult() {
return this.bindingResult; return this.bindingResult;
@@ -231,6 +229,7 @@ public class BindException extends Exception implements BindingResult {
} }
@Override @Override
@Nullable
public Object getTarget() { public Object getTarget() {
return this.bindingResult.getTarget(); return this.bindingResult.getTarget();
} }

View File

@@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -19,6 +19,7 @@ package org.springframework.validation;
import java.io.Serializable; import java.io.Serializable;
import java.util.Map; import java.util.Map;
import org.springframework.lang.NonNull;
import org.springframework.lang.Nullable; import org.springframework.lang.Nullable;
import org.springframework.util.Assert; import org.springframework.util.Assert;
@@ -52,11 +53,15 @@ public class MapBindingResult extends AbstractBindingResult implements Serializa
} }
/**
* Return the target Map to bind onto.
*/
public final Map<?, ?> getTargetMap() { public final Map<?, ?> getTargetMap() {
return this.target; return this.target;
} }
@Override @Override
@NonNull
public final Object getTarget() { public final Object getTarget() {
return this.target; return this.target;
} }

View File

@@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -217,6 +217,7 @@ public class WebExchangeBindException extends ServerWebInputException implements
} }
@Override @Override
@Nullable
public Object getTarget() { public Object getTarget() {
return this.bindingResult.getTarget(); return this.bindingResult.getTarget();
} }