类 ConcurrentModel
- java.lang.Object
- java.util.AbstractMap<K,V>
- java.util.concurrent.ConcurrentHashMap<String,Object>
- org.springframework.ui.ConcurrentModel
- 所有已实现的接口:
Serializable
,ConcurrentMap<String,Object>
,Map<String,Object>
,Model
- 直接已知子类:
BindingAwareConcurrentModel
public class ConcurrentModel extends ConcurrentHashMap<String,Object> implements Model
Implementation of theModel
interface based on aConcurrentHashMap
for use in concurrent scenarios.Exposed to handler methods by Spring WebFlux, typically via a declaration of the
Model
interface. There is typically no need to create it within user code. If necessary a handler method can return a regularjava.util.Map
, likely ajava.util.ConcurrentMap
, for a pre-determined model.- 从以下版本开始:
- 5.0
- 作者:
- Rossen Stoyanchev
- 另请参阅:
- 序列化表格
嵌套类概要
从类继承的嵌套类/接口 java.util.concurrent.ConcurrentHashMap
ConcurrentHashMap.KeySetView<K extends Object,V extends Object>
从类继承的嵌套类/接口 java.util.AbstractMap
AbstractMap.SimpleEntry<K extends Object,V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object,V extends Object>
构造器概要
构造器 构造器 说明 ConcurrentModel()
Construct a new, emptyConcurrentModel
.ConcurrentModel(Object attributeValue)
Construct a newModelMap
containing the supplied attribute.ConcurrentModel(String attributeName, Object attributeValue)
Construct a newModelMap
containing the supplied attribute under the supplied name.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 ConcurrentModel
addAllAttributes(Collection<?> attributeValues)
Copy all attributes in the suppliedCollection
into thisMap
, using attribute name generation for each element.ConcurrentModel
addAllAttributes(Map<String,?> attributes)
Copy all attributes in the suppliedMap
into thisMap
.ConcurrentModel
addAttribute(Object attributeValue)
Add the supplied attribute to thisMap
using agenerated name
.ConcurrentModel
addAttribute(String attributeName, Object attributeValue)
Add the supplied attribute under the supplied name.Map<String,Object>
asMap()
Return the current set of model attributes as a Map.boolean
containsAttribute(String attributeName)
Does this model contain an attribute of the given name?Object
getAttribute(String attributeName)
Return the attribute value for the given name, if any.ConcurrentModel
mergeAttributes(Map<String,?> attributes)
Copy all attributes in the suppliedMap
into thisMap
, with existing objects of the same name taking precedence (i.e. not getting replaced).Object
put(String key, Object value)
void
putAll(Map<? extends String,?> map)
从类继承的方法 java.util.concurrent.ConcurrentHashMap
clear, compute, computeIfAbsent, computeIfPresent, contains, containsKey, containsValue, elements, entrySet, equals, forEach, forEach, forEach, forEachEntry, forEachEntry, forEachKey, forEachKey, forEachValue, forEachValue, get, getOrDefault, hashCode, isEmpty, keys, keySet, keySet, mappingCount, merge, newKeySet, newKeySet, putIfAbsent, reduce, reduceEntries, reduceEntries, reduceEntriesToDouble, reduceEntriesToInt, reduceEntriesToLong, reduceKeys, reduceKeys, reduceKeysToDouble, reduceKeysToInt, reduceKeysToLong, reduceToDouble, reduceToInt, reduceToLong, reduceValues, reduceValues, reduceValuesToDouble, reduceValuesToInt, reduceValuesToLong, remove, remove, replace, replace, replaceAll, search, searchEntries, searchKeys, searchValues, size, toString, values
从类继承的方法 java.util.AbstractMap
clone
构造器详细资料
ConcurrentModel
public ConcurrentModel()
Construct a new, emptyConcurrentModel
.
ConcurrentModel
public ConcurrentModel(String attributeName, Object attributeValue)
Construct a newModelMap
containing the supplied attribute under the supplied name.
ConcurrentModel
public ConcurrentModel(Object attributeValue)
Construct a newModelMap
containing the supplied attribute. Uses attribute name generation to generate the key for the supplied model object.- 另请参阅:
addAttribute(Object)
方法详细资料
addAttribute
public ConcurrentModel addAttribute(String attributeName, @Nullable Object attributeValue)
Add the supplied attribute under the supplied name.- 指定者:
addAttribute
在接口中Model
- 参数:
attributeName
- the name of the model attribute (nevernull
)attributeValue
- the model attribute value (ignored ifnull
, just removing an existing entry if any)
addAttribute
public ConcurrentModel addAttribute(Object attributeValue)
Add the supplied attribute to thisMap
using agenerated name
.Note: Empty
Collections
are not added to the model when using this method because we cannot correctly determine the true convention name. View code should check fornull
rather than for empty collections as is already done by JSTL tags.- 指定者:
addAttribute
在接口中Model
- 参数:
attributeValue
- the model attribute value (nevernull
)
addAllAttributes
public ConcurrentModel addAllAttributes(@Nullable Collection<?> attributeValues)
Copy all attributes in the suppliedCollection
into thisMap
, using attribute name generation for each element.- 指定者:
addAllAttributes
在接口中Model
- 另请参阅:
addAttribute(Object)
addAllAttributes
public ConcurrentModel addAllAttributes(@Nullable Map<String,?> attributes)
Copy all attributes in the suppliedMap
into thisMap
.- 指定者:
addAllAttributes
在接口中Model
- 另请参阅:
addAttribute(String, Object)
mergeAttributes
public ConcurrentModel mergeAttributes(@Nullable Map<String,?> attributes)
Copy all attributes in the suppliedMap
into thisMap
, with existing objects of the same name taking precedence (i.e. not getting replaced).- 指定者:
mergeAttributes
在接口中Model
containsAttribute
public boolean containsAttribute(String attributeName)
Does this model contain an attribute of the given name?- 指定者:
containsAttribute
在接口中Model
- 参数:
attributeName
- the name of the model attribute (nevernull
)- 返回:
- whether this model contains a corresponding attribute
getAttribute
@Nullable public Object getAttribute(String attributeName)
从接口复制的说明:Model
Return the attribute value for the given name, if any.- 指定者:
getAttribute
在接口中Model
- 参数:
attributeName
- the name of the model attribute (nevernull
)- 返回:
- the corresponding attribute value, or
null
if none