程序包 cn.taketoday.ui
接口 Model
- 所有已知实现类:
ConcurrentModel,ExtendedModelMap,ModelMap
public interface Model
Model that defines a holder for model attributes.
Primarily designed for adding attributes to the model.
Allows for accessing the overall model as a
java.util.Map.- 从以下版本开始:
- 2018-10-14 20:30
- 作者:
- TODAY
-
方法概要
修饰符和类型方法说明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.voidclear()Clear all attributesdefault booleancontainsAttribute(String name) Contains a attribute with given namegetAttribute(String name) Returns the value of the named attribute as anObject, ornullif no attribute of the given name exists.default String[]Return the names of all attributes.booleanisEmpty()Returnstrueif this map contains no key-value mappings.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.default voidsetAttributes(Map<String, Object> attributes) Add the attributes from map
-
方法详细资料
-
containsAttribute
Contains a attribute with given name- 参数:
name- Attribute name- 返回:
- if contains the attribute
-
setAttributes
Add the attributes from map- 参数:
attributes- The attributes
-
getAttribute
Returns the value of the named attribute as anObject, ornullif no attribute of the given name exists.- 参数:
name- aStringspecifying the name of the attribute- 返回:
- an
Objectcontaining the value of the attribute, ornullif the attribute does not exist
-
setAttribute
Stores an attribute in this request. Attributes are reset between requests..- 参数:
name- aStringspecifying the name of the attributevalue- theObjectto be stored
-
addAttribute
Add the supplied attribute under the supplied name.- 参数:
attributeName- the name of the model attribute (nevernull)attributeValue- the model attribute value (can benull)- 从以下版本开始:
- 4.0
-
removeAttribute
Removes an attribute from this request. This method is not generally needed as attributes only persist as long as the request is being handled.- 参数:
name- aStringspecifying the name of the attribute to remove- 返回:
- the last value of the attribute, if any
-
asMap
Convert this model to aMap -
clear
void clear()Clear all attributes -
isEmpty
boolean isEmpty()Returnstrueif this map contains no key-value mappings.- 返回:
trueif this map contains no key-value mappings- 从以下版本开始:
- 4.0
-
getAttributeNames
Return the names of all attributes.- 从以下版本开始:
- 4.0
-
attributeNames
Return the names Iterator.- 从以下版本开始:
- 4.0
-
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.- 参数:
attributeValue- the model attribute value- 从以下版本开始:
- 4.0
-
addAllAttributes
Copy all attributes in the suppliedCollectioninto thisMap, using attribute name generation for each element.- 从以下版本开始:
- 4.0
- 另请参阅:
-
addAllAttributes
Copy all attributes in the suppliedMapinto thisMap.- 从以下版本开始:
- 4.0
- 另请参阅:
-
mergeAttributes
Copy all attributes in the suppliedMapinto thisMap, with existing objects of the same name taking precedence (i.e. not getting replaced).- 从以下版本开始:
- 4.0
-