Package org.springframework.ui
Class ConcurrentModel
- All Implemented Interfaces:
- Serializable,- ConcurrentMap<String,,- Object> - Map<String,,- Object> - Model
- Direct Known Subclasses:
- BindingAwareConcurrentModel
Implementation of the 
Model interface based on a ConcurrentHashMap
 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 regular java.util.Map,
 likely a java.util.ConcurrentMap, for a pre-determined model.
- Since:
- 5.0
- Author:
- Rossen Stoyanchev
- See Also:
- 
Nested Class SummaryNested classes/interfaces inherited from class java.util.concurrent.ConcurrentHashMapConcurrentHashMap.KeySetView<K extends Object,V extends Object> Nested classes/interfaces inherited from class java.util.AbstractMapAbstractMap.SimpleEntry<K extends Object,V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object, V extends Object> 
- 
Constructor SummaryConstructorsConstructorDescriptionConstruct a new, emptyConcurrentModel.ConcurrentModel(Object attributeValue) Construct a newConcurrentModelcontaining the supplied attribute.ConcurrentModel(String attributeName, Object attributeValue) Construct a newConcurrentModelcontaining the supplied attribute under the supplied name.
- 
Method SummaryModifier and TypeMethodDescriptionaddAllAttributes(Collection<?> attributeValues) Copy all attributes in the suppliedCollectioninto thisMap, using attribute name generation for each element.addAllAttributes(Map<String, ?> attributes) Copy all attributes in the suppliedMapinto thisMap.addAttribute(Object attributeValue) Add the supplied attribute to thisMapusing agenerated name.addAttribute(String attributeName, Object attributeValue) Add the supplied attribute under the supplied name.asMap()Return the current set of model attributes as a Map.booleancontainsAttribute(String attributeName) Does this model contain an attribute of the given name?getAttribute(String attributeName) Return the attribute value for the given name, if any.mergeAttributes(Map<String, ?> attributes) Copy all attributes in the suppliedMapinto thisMap, with existing objects of the same name taking precedence (i.e.voidMethods inherited from class java.util.concurrent.ConcurrentHashMapclear, 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, valuesMethods inherited from class java.util.AbstractMapclone
- 
Constructor Details- 
ConcurrentModelpublic ConcurrentModel()Construct a new, emptyConcurrentModel.
- 
ConcurrentModelConstruct a newConcurrentModelcontaining the supplied attribute under the supplied name.- See Also:
 
- 
ConcurrentModelConstruct a newConcurrentModelcontaining the supplied attribute.Uses attribute name generation to generate the key for the supplied model object. - See Also:
 
 
- 
- 
Method Details- 
put
- 
putAll
- 
addAttributeAdd the supplied attribute under the supplied name.- Specified by:
- addAttributein interface- Model
- Parameters:
- attributeName- the name of the model attribute (never- null)
- attributeValue- the model attribute value (ignored if- null, just removing an existing entry if any)
 
- 
addAttributeAdd the supplied attribute to thisMapusing agenerated name.Note: Empty Collectionsare not added to the model when using this method because we cannot correctly determine the true convention name. View code should check fornullrather than for empty collections as is already done by JSTL tags.- Specified by:
- addAttributein interface- Model
- Parameters:
- attributeValue- the model attribute value (never- null)
 
- 
addAllAttributesCopy all attributes in the suppliedCollectioninto thisMap, using attribute name generation for each element.- Specified by:
- addAllAttributesin interface- Model
- See Also:
 
- 
addAllAttributesCopy all attributes in the suppliedMapinto thisMap.- Specified by:
- addAllAttributesin interface- Model
- See Also:
 
- 
mergeAttributesCopy all attributes in the suppliedMapinto thisMap, with existing objects of the same name taking precedence (i.e. not getting replaced).- Specified by:
- mergeAttributesin interface- Model
 
- 
containsAttributeDoes this model contain an attribute of the given name?- Specified by:
- containsAttributein interface- Model
- Parameters:
- attributeName- the name of the model attribute (never- null)
- Returns:
- whether this model contains a corresponding attribute
 
- 
getAttributeDescription copied from interface:ModelReturn the attribute value for the given name, if any.- Specified by:
- getAttributein interface- Model
- Parameters:
- attributeName- the name of the model attribute (never- null)
- Returns:
- the corresponding attribute value, or nullif none
 
- 
asMapDescription copied from interface:ModelReturn the current set of model attributes as a Map.
 
-