|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
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
public class RedirectAttributesModelMap
A ModelMap
implementation of RedirectAttributes
that formats
values as Strings using a DataBinder
. Also provides a place to store
flash attributes so they can survive a redirect without the need to be
embedded in the redirect URL.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.util.AbstractMap |
---|
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V> |
Constructor Summary | |
---|---|
RedirectAttributesModelMap()
Default constructor without a DataBinder. |
|
RedirectAttributesModelMap(DataBinder dataBinder)
Class constructor. |
Method Summary | |
---|---|
RedirectAttributesModelMap |
addAllAttributes(Collection<?> attributeValues)
Copy all attributes in the supplied Collection into this
Map , using attribute name generation for each element. |
RedirectAttributesModelMap |
addAllAttributes(Map<String,?> attributes)
Copy all attributes in the supplied Map into this Map . |
RedirectAttributesModelMap |
addAttribute(Object attributeValue)
Add the supplied attribute to this Map using a
generated 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 a generated 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 supplied Map into this Map ,
with existing objects of the same name taking precedence (i.e. |
Object |
put(String key,
Object value)
|
void |
putAll(Map<? extends String,? extends Object> map)
|
Methods inherited from class org.springframework.ui.ModelMap |
---|
addAllObjects, addAllObjects, addObject, addObject, containsAttribute |
Methods inherited from class java.util.LinkedHashMap |
---|
clear, containsValue, get, removeEldestEntry |
Methods inherited from class java.util.HashMap |
---|
clone, containsKey, entrySet, isEmpty, keySet, remove, size, values |
Methods inherited from class java.util.AbstractMap |
---|
equals, hashCode, toString |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.springframework.ui.Model |
---|
containsAttribute |
Methods inherited from interface java.util.Map |
---|
containsKey, entrySet, equals, hashCode, isEmpty, keySet, remove, size, values |
Constructor Detail |
---|
public RedirectAttributesModelMap(DataBinder dataBinder)
dataBinder
- used to format attribute values as Strings.public RedirectAttributesModelMap()
AbstractMap.toString()
.
Method Detail |
---|
public Map<String,?> getFlashAttributes()
getFlashAttributes
in interface RedirectAttributes
public RedirectAttributesModelMap addAttribute(String attributeName, Object attributeValue)
Formats the attribute value as a String before adding it.
addAttribute
in interface Model
addAttribute
in interface RedirectAttributes
addAttribute
in class ModelMap
attributeName
- the name of the model attribute (never null
)attributeValue
- the model attribute value (can be null
)public RedirectAttributesModelMap addAttribute(Object attributeValue)
Map
using a
generated name
.
Collections
are not added to
the model when using this method because we cannot correctly determine
the true convention name. View code should check for null
rather
than for empty collections as is already done by JSTL tags.
Formats the attribute value as a String before adding it.
addAttribute
in interface Model
addAttribute
in interface RedirectAttributes
addAttribute
in class ModelMap
attributeValue
- the model attribute value (never null
)public RedirectAttributesModelMap addAllAttributes(Collection<?> attributeValues)
Collection
into this
Map
, using attribute name generation for each element.
Each attribute value is formatted as a String before being added.
addAllAttributes
in interface Model
addAllAttributes
in interface RedirectAttributes
addAllAttributes
in class ModelMap
ModelMap.addAttribute(Object)
public RedirectAttributesModelMap addAllAttributes(Map<String,?> attributes)
Map
into this Map
.
Each attribute value is formatted as a String before being added.
addAllAttributes
in interface Model
addAllAttributes
in class ModelMap
ModelMap.addAttribute(String, Object)
public RedirectAttributesModelMap mergeAttributes(Map<String,?> attributes)
Map
into this Map
,
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
in interface Model
mergeAttributes
in interface RedirectAttributes
mergeAttributes
in class ModelMap
public Map<String,Object> asMap()
Model
asMap
in interface Model
public Object put(String key, Object value)
The value is formatted as a String before being added.
put
in interface Map<String,Object>
put
in class HashMap<String,Object>
public void putAll(Map<? extends String,? extends Object> map)
Each value is formatted as a String before being added.
putAll
in interface Map<String,Object>
putAll
in class HashMap<String,Object>
public RedirectAttributes addFlashAttribute(String attributeName, Object attributeValue)
RedirectAttributes
addFlashAttribute
in interface RedirectAttributes
attributeName
- the attribute name; never null
attributeValue
- the attribute value; may be null
public RedirectAttributes addFlashAttribute(Object attributeValue)
RedirectAttributes
generated name
.
addFlashAttribute
in interface RedirectAttributes
attributeValue
- the flash attribute value; never null
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |