ConcurrentModel.addAttribute javadoc: null value not supported

Issue: SPR-16831
This commit is contained in:
Juergen Hoeller 2018-05-18 22:20:08 +02:00
parent fbd12e9d16
commit 5b3bbad6a0
1 changed files with 6 additions and 4 deletions

View File

@ -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");
@ -84,10 +85,11 @@ public class ConcurrentModel extends ConcurrentHashMap<String, Object> implement
* 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>
* @param attributeValue the model attribute value (never {@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(@Nullable Object attributeValue) {
Assert.notNull(attributeValue, "Model object must not be null");
Assert.notNull(attributeValue, "Model attribute value must not be null");
if (attributeValue instanceof Collection && ((Collection<?>) attributeValue).isEmpty()) {
return this;
}