org.apache.struts2.portlet
Class PortletSessionMap
java.lang.Object
java.util.AbstractMap
org.apache.struts2.portlet.PortletSessionMap
- All Implemented Interfaces:
- java.util.Map
public class PortletSessionMap
- extends java.util.AbstractMap
A simple implementation of the Map
interface to handle a collection of portlet session
attributes. The entrySet()
method enumerates over all session attributes and creates a Set of entries.
Note, this will occur lazily - only when the entry set is asked for.
Nested classes/interfaces inherited from class java.util.AbstractMap |
java.util.AbstractMap.SimpleEntry<K,V>, java.util.AbstractMap.SimpleImmutableEntry<K,V> |
Nested classes/interfaces inherited from interface java.util.Map |
java.util.Map.Entry<K,V> |
Constructor Summary |
PortletSessionMap(javax.portlet.PortletRequest request)
Creates a new session map given a portlet request. |
Method Summary |
void |
clear()
|
java.util.Set |
entrySet()
|
java.lang.Object |
get(java.lang.Object key)
Returns the session attribute associated with the given key or
null if it doesn't exist. |
java.lang.Object |
put(java.lang.Object key,
java.lang.Object value)
Saves an attribute in the session. |
java.lang.Object |
remove(java.lang.Object key)
Removes the specified session attribute. |
Methods inherited from class java.util.AbstractMap |
clone, containsKey, containsValue, equals, hashCode, isEmpty, keySet, putAll, size, toString, values |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
PortletSessionMap
public PortletSessionMap(javax.portlet.PortletRequest request)
- Creates a new session map given a portlet request.
- Parameters:
request
- the portlet request object.
entrySet
public java.util.Set entrySet()
- Specified by:
entrySet
in interface java.util.Map
- Specified by:
entrySet
in class java.util.AbstractMap
- See Also:
Map.entrySet()
get
public java.lang.Object get(java.lang.Object key)
- Returns the session attribute associated with the given key or
null if it doesn't exist.
- Specified by:
get
in interface java.util.Map
- Overrides:
get
in class java.util.AbstractMap
- Parameters:
key
- the name of the session attribute.
- Returns:
- the session attribute or null if it doesn't exist.
put
public java.lang.Object put(java.lang.Object key,
java.lang.Object value)
- Saves an attribute in the session.
- Specified by:
put
in interface java.util.Map
- Overrides:
put
in class java.util.AbstractMap
- Parameters:
key
- the name of the session attribute.value
- the value to set.
- Returns:
- the object that was just set.
clear
public void clear()
- Specified by:
clear
in interface java.util.Map
- Overrides:
clear
in class java.util.AbstractMap
- See Also:
Map.clear()
remove
public java.lang.Object remove(java.lang.Object key)
- Removes the specified session attribute.
- Specified by:
remove
in interface java.util.Map
- Overrides:
remove
in class java.util.AbstractMap
- Parameters:
key
- the name of the attribute to remove.
- Returns:
- the value that was removed or null if the value was
not found (and hence, not removed).
Copyright © 2000-2011 Apache Software Foundation. All Rights Reserved.