程序包 cn.taketoday.ui
类 ModelMap
- 直接已知子类:
ExtendedModelMap
Implementation of
Map for use when building model data for use
with UI tools. Supports chained calls and generation of model attribute names.
This class serves as generic model holder for Servlet MVC but is not tied to it.
Check out the Model interface for an interface variant.
- 从以下版本开始:
- 4.0 2022/4/8 22:58
- 作者:
- Rob Harrop, Juergen Hoeller, Harry Yang
- 另请参阅:
-
Conventions.getVariableName(java.lang.Object)ModelAndView- 序列化表格
-
嵌套类概要
从类继承的嵌套类/接口 java.util.AbstractMap
AbstractMap.SimpleEntry<K extends Object,V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object, V extends Object> -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明addAllAttributes(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()Convert this model to aMapReturn the names Iterator.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. not getting replaced).removeAttribute(String name) Removes an attribute from this request.voidsetAttribute(String name, Object value) Stores an attribute in this request.从类继承的方法 java.util.LinkedHashMap
clear, containsValue, entrySet, forEach, get, getOrDefault, keySet, removeEldestEntry, replaceAll, values从类继承的方法 java.util.HashMap
clone, compute, computeIfAbsent, computeIfPresent, containsKey, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, size从类继承的方法 java.util.AbstractMap
equals, hashCode, toString从接口继承的方法 java.util.Map
compute, computeIfAbsent, computeIfPresent, containsKey, equals, hashCode, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, size从接口继承的方法 cn.taketoday.ui.Model
clear, getAttributeNames, isEmpty, setAttributes
-
构造器详细资料
-
ModelMap
public ModelMap()Construct a new, emptyModelMap. -
ModelMap
Construct a newModelMapcontaining the supplied attribute under the supplied name. -
ModelMap
Construct a newModelMapcontaining the supplied attribute. Uses attribute name generation to generate the key for the supplied model object.- 另请参阅:
-
-
方法详细资料
-
addAttribute
Add the supplied attribute under the supplied name.- 指定者:
addAttribute在接口中Model- 参数:
attributeName- the name of the model attribute (nevernull)attributeValue- the model attribute value (can benull)
-
addAttribute
Add 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.- 指定者:
addAttribute在接口中Model- 参数:
attributeValue- the model attribute value (nevernull)
-
addAllAttributes
Copy all attributes in the suppliedCollectioninto thisMap, using attribute name generation for each element.- 指定者:
addAllAttributes在接口中Model- 另请参阅:
-
addAllAttributes
Copy all attributes in the suppliedMapinto thisMap.- 指定者:
addAllAttributes在接口中Model- 另请参阅:
-
mergeAttributes
Copy all attributes in the suppliedMapinto thisMap, with existing objects of the same name taking precedence (i.e. not getting replaced).- 指定者:
mergeAttributes在接口中Model
-
containsAttribute
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
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
nullif none
-
setAttribute
从接口复制的说明:ModelStores an attribute in this request. Attributes are reset between requests..- 指定者:
setAttribute在接口中Model- 参数:
name- aStringspecifying the name of the attributevalue- theObjectto be stored
-
removeAttribute
从接口复制的说明:ModelRemoves an attribute from this request. This method is not generally needed as attributes only persist as long as the request is being handled.- 指定者:
removeAttribute在接口中Model- 参数:
name- aStringspecifying the name of the attribute to remove- 返回:
- the last value of the attribute, if any
-
asMap
从接口复制的说明:ModelConvert this model to aMap -
attributeNames
从接口复制的说明:ModelReturn the names Iterator.- 指定者:
attributeNames在接口中Model
-