Package org.apache.commons.chain.web
Class AbstractSessionScopeMap<S,R> 
java.lang.Object
org.apache.commons.chain.web.AbstractSessionScopeMap<S,R> 
- Type Parameters:
 S- the type of the session-classR- the type of the request-class
Implementation of 
Map for session attributes with a
 parameter-provider.- Since:
 - Chain 1.3
 - Author:
 - Graff Stefan
 
- 
Nested Class Summary
 - 
Constructor Summary
ConstructorsConstructorDescriptionAbstractSessionScopeMap(R request) The constructor for the session attributes. - 
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Removes all of the mappings from this session-map.booleancontainsKey(Object key) Returnstrueif this session-map contains a mapping for the specified key.booleancontainsValue(Object value) Returnstrueif this session-map maps one or more keys to the specified value.protected abstract MutableParameterMap<S, Object> Creates a new mutable-parameter-map to access the session-attributes.entrySet()Returns aSetview of the mappings contained in this session-map.booleanCompares the specified object with this session-map for equality.Returns the value to which the specified key is mapped, ornullif this session-map contains no mapping for the key.protected RReturns the request-class.protected SReturns the session-class.protected abstract SgetSession(boolean create) Returns the current session or, if there is no current session and the given flag istrue, creates one and returns the new session.inthashCode()Returns the hash code value for this session-map.booleanisEmpty()Returnstrueif this session-map contains no key-value mappings.keySet()Returns aSetview of the keys contained in this session-map.Associates the specified value with the specified key in this session-map.voidCopies all of the mappings from the specified map to this session-map.Removes the mapping for the specified key from this session-map if present.protected booleanReturnstrueif a session exists.protected booleansessionExists(boolean create) Returnstrueif a session exists or creates a new session if the parametercreateis set totrue.intsize()Returns the number of key-value mappings in this session-map.toString()Returns a string representation of this session-map.values()Returns aCollectionview of the values contained in this session-map.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll 
- 
Constructor Details
- 
AbstractSessionScopeMap
The constructor for the session attributes.- Parameters:
 request- the request-class
 
 - 
 - 
Method Details
- 
clear
Removes all of the mappings from this session-map. The session-map will be empty after this call returns. - 
containsKey
Returnstrueif this session-map contains a mapping for the specified key.- Specified by:
 containsKeyin interfaceMap<S,R> - Parameters:
 key- The key whose presence in this session-map is to be tested- Returns:
 trueif this session-map contains a mapping for the specified key.
 - 
containsValue
Returnstrueif this session-map maps one or more keys to the specified value.- Specified by:
 containsValuein interfaceMap<S,R> - Parameters:
 value- value whose presence in this session-map is to be tested- Returns:
 trueif this session-map maps one or more keys to the specified value
 - 
entrySet
Returns aSetview of the mappings contained in this session-map. The set is not backed by the session-map, so changes to the session-map are not reflected in the set, and vice-versa. - 
get
Returns the value to which the specified key is mapped, ornullif this session-map contains no mapping for the key.A return value of
nulldoes not necessarily indicate that the session-map contains no mapping for the key; it's also possible that the session-map explicitly maps the key tonull. ThecontainsKeyoperation may be used to distinguish these two cases. - 
isEmpty
Returnstrueif this session-map contains no key-value mappings. - 
keySet
Returns aSetview of the keys contained in this session-map. The set is not backed by the session-map, so changes to the session-map are not reflected in the set, and vice-versa. - 
put
Associates the specified value with the specified key in this session-map. If the session-map previously contained a mapping for the key, the old value is replaced.- Specified by:
 putin interfaceMap<S,R> - Parameters:
 key- key with which the specified value is to be associatedvalue- value to be associated with the specified key- Returns:
 - the previous value associated with 
key, ornullif there was no mapping forkey. (Anullreturn can also indicate that the session-map previously associatednullwithkey.) 
 - 
putAll
Copies all of the mappings from the specified map to this session-map. These mappings will replace any mappings that this session-map had for any of the keys currently in the specified map.- Specified by:
 putAllin interfaceMap<S,R> - Parameters:
 map- mappings to be stored in this session-map- Throws:
 NullPointerException- if the specified map is null
 - 
remove
Removes the mapping for the specified key from this session-map if present. - 
size
Returns the number of key-value mappings in this session-map. - 
values
Returns aCollectionview of the values contained in this session-map. The collection is not backed by the session-map, so changes to the session-map are not reflected in the collection, and vice-versa. - 
hashCode
Returns the hash code value for this session-map. The hash code of a session-map is defined to be the sum of the hash codes of each entry in the session-map'sentrySet()view. This ensures thatm1.equals(m2)implies thatm1.hashCode()==m2.hashCode()for any two session-mapsm1andm2, as required by the general contract ofObject.hashCode(). - 
equals
Compares the specified object with this session-map for equality. Returnstrueif the given object is also a session-map and the two session-maps represent the same mappings. More formally, two session-mapsm1andm2represent the same mappings ifm1.entrySet().equals(m2.entrySet()). - 
toString
Returns a string representation of this session-map. - 
getSession
Returns the session-class.- Returns:
 - the session-class
 
 - 
getRequest
Returns the request-class.- Returns:
 - the request-class
 
 - 
sessionExists
Returnstrueif a session exists.- Returns:
 trueif a session exists
 - 
sessionExists
Returnstrueif a session exists or creates a new session if the parametercreateis set totrue.- Parameters:
 create-trueto create a new session if no session exists- Returns:
 trueif a session exists
 - 
getSession
Returns the current session or, if there is no current session and the given flag istrue, creates one and returns the new session.If the given flag is
falseand there is no current session, this method returnsnull.- Parameters:
 create-trueto create a new session,falseto returnnullif there is no current session- Returns:
 - the session
 
 - 
createParameterMap
Creates a new mutable-parameter-map to access the session-attributes.- Returns:
 - a new mutable-parameter-map to access the session-attributes
 
 
 -