类 RedirectAttributesModelMap
- java.lang.Object
- java.util.AbstractMap<K,V>
- java.util.HashMap<K,V>
- java.util.LinkedHashMap<String,Object>
- org.springframework.ui.ModelMap
- org.springframework.web.servlet.mvc.support.RedirectAttributesModelMap
- 所有已实现的接口:
Serializable
,Cloneable
,Map<String,Object>
,Model
,RedirectAttributes
public class RedirectAttributesModelMap extends ModelMap implements RedirectAttributes
AModelMap
implementation ofRedirectAttributes
that formats values as Strings using aDataBinder
. Also provides a place to store flash attributes so they can survive a redirect without the need to be embedded in the redirect URL.- 从以下版本开始:
- 3.1
- 作者:
- Rossen Stoyanchev
- 另请参阅:
- 序列化表格
嵌套类概要
从类继承的嵌套类/接口 java.util.AbstractMap
AbstractMap.SimpleEntry<K extends Object,V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object,V extends Object>
构造器概要
构造器 构造器 说明 RedirectAttributesModelMap()
Default constructor without a DataBinder.RedirectAttributesModelMap(DataBinder dataBinder)
Constructor with a DataBinder.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 RedirectAttributesModelMap
addAllAttributes(Collection<?> attributeValues)
Copy all attributes in the suppliedCollection
into thisMap
, using attribute name generation for each element.RedirectAttributesModelMap
addAllAttributes(Map<String,?> attributes)
Copy all attributes in the suppliedMap
into thisMap
.RedirectAttributesModelMap
addAttribute(Object attributeValue)
Add the supplied attribute to thisMap
using agenerated name
.RedirectAttributesModelMap
addAttribute(String attributeName, Object attributeValue)
Add the supplied attribute under the supplied name.RedirectAttributes
addFlashAttribute(Object attributeValue)
Add the given flash storage using agenerated name
.RedirectAttributes
addFlashAttribute(String attributeName, Object attributeValue)
Add the given flash attribute.Map<String,Object>
asMap()
Return the current set of model attributes as a Map.Map<String,?>
getFlashAttributes()
Return the attributes candidate for flash storage or an empty Map.RedirectAttributesModelMap
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,? extends Object> map)
从类继承的方法 org.springframework.ui.ModelMap
containsAttribute, getAttribute
从类继承的方法 java.util.LinkedHashMap
clear, containsValue, entrySet, forEach, get, getOrDefault, keySet, removeEldestEntry, replaceAll, values
从类继承的方法 java.util.HashMap
clone, compute, computeIfAbsent, computeIfPresent, containsKey, isEmpty, merge, putIfAbsent, remove, remove, replace, replace, size
从类继承的方法 java.util.AbstractMap
equals, hashCode, toString
从接口继承的方法 java.util.Map
compute, computeIfAbsent, computeIfPresent, containsKey, equals, hashCode, isEmpty, merge, putIfAbsent, remove, remove, replace, replace, size
从接口继承的方法 org.springframework.ui.Model
containsAttribute, getAttribute
构造器详细资料
RedirectAttributesModelMap
public RedirectAttributesModelMap()
Default constructor without a DataBinder. Attribute values are converted to String viaAbstractMap.toString()
.
RedirectAttributesModelMap
public RedirectAttributesModelMap(@Nullable DataBinder dataBinder)
Constructor with a DataBinder.- 参数:
dataBinder
- used to format attribute values as Strings
方法详细资料
getFlashAttributes
public Map<String,?> getFlashAttributes()
Return the attributes candidate for flash storage or an empty Map.- 指定者:
getFlashAttributes
在接口中RedirectAttributes
addAttribute
public RedirectAttributesModelMap addAttribute(String attributeName, @Nullable Object attributeValue)
Add the supplied attribute under the supplied name.Formats the attribute value as a String before adding it.
- 指定者:
addAttribute
在接口中Model
- 指定者:
addAttribute
在接口中RedirectAttributes
- 覆盖:
addAttribute
在类中ModelMap
- 参数:
attributeName
- the name of the model attribute (nevernull
)attributeValue
- the model attribute value (can benull
)
addAttribute
public RedirectAttributesModelMap 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.Formats the attribute value as a String before adding it.
- 指定者:
addAttribute
在接口中Model
- 指定者:
addAttribute
在接口中RedirectAttributes
- 覆盖:
addAttribute
在类中ModelMap
- 参数:
attributeValue
- the model attribute value (nevernull
)
addAllAttributes
public RedirectAttributesModelMap addAllAttributes(@Nullable Collection<?> attributeValues)
Copy all attributes in the suppliedCollection
into thisMap
, using attribute name generation for each element.Each attribute value is formatted as a String before being added.
- 指定者:
addAllAttributes
在接口中Model
- 指定者:
addAllAttributes
在接口中RedirectAttributes
- 覆盖:
addAllAttributes
在类中ModelMap
- 另请参阅:
ModelMap.addAttribute(Object)
addAllAttributes
public RedirectAttributesModelMap addAllAttributes(@Nullable Map<String,?> attributes)
Copy all attributes in the suppliedMap
into thisMap
.Each attribute value is formatted as a String before being added.
- 指定者:
addAllAttributes
在接口中Model
- 覆盖:
addAllAttributes
在类中ModelMap
- 另请参阅:
ModelMap.addAttribute(String, Object)
mergeAttributes
public RedirectAttributesModelMap 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).Each attribute value is formatted as a String before being merged.
- 指定者:
mergeAttributes
在接口中Model
- 指定者:
mergeAttributes
在接口中RedirectAttributes
- 覆盖:
mergeAttributes
在类中ModelMap
asMap
public Map<String,Object> asMap()
从接口复制的说明:Model
Return the current set of model attributes as a Map.
put
public Object put(String key, @Nullable Object value)
The value is formatted as a String before being added.
putAll
public void putAll(@Nullable Map<? extends String,? extends Object> map)
Each value is formatted as a String before being added.
addFlashAttribute
public RedirectAttributes addFlashAttribute(String attributeName, @Nullable Object attributeValue)
从接口复制的说明:RedirectAttributes
Add the given flash attribute.- 指定者:
addFlashAttribute
在接口中RedirectAttributes
- 参数:
attributeName
- the attribute name; nevernull
attributeValue
- the attribute value; may benull
addFlashAttribute
public RedirectAttributes addFlashAttribute(Object attributeValue)
从接口复制的说明:RedirectAttributes
Add the given flash storage using agenerated name
.- 指定者:
addFlashAttribute
在接口中RedirectAttributes
- 参数:
attributeValue
- the flash attribute value; nevernull