ConcurrentModel.addAttribute javadoc: null value not supported
Issue: SPR-16831
This commit is contained in:
parent
99534a31ba
commit
a1d35c23aa
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
* Copyright 2002-2018 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.
|
||||
|
|
@ -68,7 +68,8 @@ public class ConcurrentModel extends ConcurrentHashMap<String, Object> implement
|
|||
/**
|
||||
* Add the supplied attribute under the supplied name.
|
||||
* @param attributeName the name of the model attribute (never {@code null})
|
||||
* @param attributeValue the model attribute value (can be {@code null})
|
||||
* @param attributeValue the model attribute value (never {@code null} for {@code ConcurrentModel},
|
||||
* with the {@code Nullable} declaration inherited from {@link Model#addAttribute(String, Object)})
|
||||
*/
|
||||
public ConcurrentModel addAttribute(String attributeName, @Nullable Object attributeValue) {
|
||||
Assert.notNull(attributeName, "Model attribute name must not be null");
|
||||
|
|
@ -80,14 +81,14 @@ public class ConcurrentModel extends ConcurrentHashMap<String, Object> implement
|
|||
/**
|
||||
* Add the supplied attribute to this {@code Map} using a
|
||||
* {@link org.springframework.core.Conventions#getVariableName generated name}.
|
||||
* <p><emphasis>Note: Empty {@link Collection Collections} are not added to
|
||||
* <p><i>Note: Empty {@link Collection Collections} are not added to
|
||||
* the model when using this method because we cannot correctly determine
|
||||
* the true convention name. View code should check for {@code null} rather
|
||||
* than for empty collections as is already done by JSTL tags.</emphasis>
|
||||
* than for empty collections as is already done by JSTL tags.</i>
|
||||
* @param attributeValue the model attribute value (never {@code null})
|
||||
*/
|
||||
public ConcurrentModel addAttribute(@Nullable Object attributeValue) {
|
||||
Assert.notNull(attributeValue, "Model object must not be null");
|
||||
public ConcurrentModel addAttribute(Object attributeValue) {
|
||||
Assert.notNull(attributeValue, "Model attribute value must not be null");
|
||||
if (attributeValue instanceof Collection && ((Collection<?>) attributeValue).isEmpty()) {
|
||||
return this;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue