org.apache.struts2.portlet
Class PortletSessionMap

java.lang.Object
  extended by java.util.AbstractMap
      extended by org.apache.struts2.portlet.PortletSessionMap
All Implemented Interfaces:
Map

public class PortletSessionMap
extends 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 Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry<K,V>
 
Field Summary
private  Set<Object> entries
           
private static Log LOG
           
private  javax.portlet.PortletSession session
           
 
Constructor Summary
PortletSessionMap(javax.portlet.PortletRequest request)
          Creates a new session map given a portlet request.
 
Method Summary
 void clear()
           
 Set entrySet()
           
 Object get(Object key)
          Returns the session attribute associated with the given key or null if it doesn't exist.
 Object put(Object key, Object value)
          Saves an attribute in the session.
 Object remove(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
 

Field Detail

LOG

private static final Log LOG

session

private javax.portlet.PortletSession session

entries

private Set<Object> entries
Constructor Detail

PortletSessionMap

public PortletSessionMap(javax.portlet.PortletRequest request)
Creates a new session map given a portlet request.

Parameters:
request - the portlet request object.
Method Detail

entrySet

public Set entrySet()
Specified by:
entrySet in interface Map
Specified by:
entrySet in class AbstractMap
See Also:
Map.entrySet()

get

public Object get(Object key)
Returns the session attribute associated with the given key or null if it doesn't exist.

Specified by:
get in interface Map
Overrides:
get in class AbstractMap
Parameters:
key - the name of the session attribute.
Returns:
the session attribute or null if it doesn't exist.

put

public Object put(Object key,
                  Object value)
Saves an attribute in the session.

Specified by:
put in interface Map
Overrides:
put in class 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 Map
Overrides:
clear in class AbstractMap
See Also:
Map.clear()

remove

public Object remove(Object key)
Removes the specified session attribute.

Specified by:
remove in interface Map
Overrides:
remove in class 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-2008 Apache Software Foundation. All Rights Reserved.