Class FlexibleServletAccessor<T>
- java.lang.Object
-
- org.apache.ofbiz.base.util.collections.FlexibleServletAccessor<T>
-
- All Implemented Interfaces:
java.io.Serializable
public class FlexibleServletAccessor<T> extends java.lang.Object implements java.io.Serializable
Used to flexibly access Map values, supporting the "." (dot) syntax for accessing sub-map values and the "[]" (square bracket) syntax for accessing list elements. See individual Map operations for more information.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
FlexibleServletAccessor.AttributeAccessor<T>
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.String
attributeName
protected boolean
empty
protected FlexibleMapAccessor<T>
fma
protected java.lang.String
name
protected boolean
needsExpand
-
Constructor Summary
Constructors Constructor Description FlexibleServletAccessor(java.lang.String name)
FlexibleServletAccessor(java.lang.String name, java.lang.String defaultName)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object obj)
The equals and hashCode methods are implemented just case this object is ever accidently used as a Map keyT
get(javax.servlet.http.HttpSession session, java.util.Map<java.lang.String,java.lang.Object> expandContext)
Based on name get from HttpSession or from List in HttpSessionT
get(javax.servlet.ServletRequest request, java.util.Map<java.lang.String,java.lang.Object> expandContext)
Based on name get from ServletRequest or from List in ServletRequestint
hashCode()
The equals and hashCode methods are implemented just case this object is ever accidently used as a Map key *protected void
init(java.lang.String name)
boolean
isEmpty()
void
put(javax.servlet.http.HttpSession session, T value, java.util.Map<java.lang.String,java.lang.Object> expandContext)
Based on name put in HttpSession or from List in HttpSession; If the brackets for a list are empty the value will be appended to the list, otherwise the value will be set in the position of the number in the brackets.void
put(javax.servlet.ServletRequest request, T value, java.util.Map<java.lang.String,java.lang.Object> expandContext)
Based on name put in ServletRequest or from List in ServletRequest; If the brackets for a list are empty the value will be appended to the list, otherwise the value will be set in the position of the number in the brackets.T
remove(javax.servlet.http.HttpSession session, java.util.Map<java.lang.String,java.lang.Object> expandContext)
Based on name remove from HttpSession or from List in HttpSessionT
remove(javax.servlet.ServletRequest request, java.util.Map<java.lang.String,java.lang.Object> expandContext)
Based on name remove from ServletRequest or from List in ServletRequestjava.lang.String
toString()
To be used for a string representation of the accessor, returns the original name.
-
-
-
Field Detail
-
name
protected java.lang.String name
-
attributeName
protected java.lang.String attributeName
-
fma
protected FlexibleMapAccessor<T> fma
-
needsExpand
protected boolean needsExpand
-
empty
protected boolean empty
-
-
Method Detail
-
init
protected void init(java.lang.String name)
-
isEmpty
public boolean isEmpty()
-
get
public T get(javax.servlet.ServletRequest request, java.util.Map<java.lang.String,java.lang.Object> expandContext)
Based on name get from ServletRequest or from List in ServletRequest- Parameters:
request
- request to get the value fromexpandContext
- the context to use for name expansion- Returns:
- the object corresponding to this getter class
-
get
public T get(javax.servlet.http.HttpSession session, java.util.Map<java.lang.String,java.lang.Object> expandContext)
Based on name get from HttpSession or from List in HttpSession- Parameters:
session
-expandContext
-- Returns:
- the found value
-
put
public void put(javax.servlet.ServletRequest request, T value, java.util.Map<java.lang.String,java.lang.Object> expandContext)
Based on name put in ServletRequest or from List in ServletRequest; If the brackets for a list are empty the value will be appended to the list, otherwise the value will be set in the position of the number in the brackets. If a "+" (plus sign) is included inside the square brackets before the index number the value will inserted/added at that point instead of set at the point.- Parameters:
request
-value
-expandContext
-
-
put
public void put(javax.servlet.http.HttpSession session, T value, java.util.Map<java.lang.String,java.lang.Object> expandContext)
Based on name put in HttpSession or from List in HttpSession; If the brackets for a list are empty the value will be appended to the list, otherwise the value will be set in the position of the number in the brackets. If a "+" (plus sign) is included inside the square brackets before the index number the value will inserted/added at that point instead of set at the point.- Parameters:
session
-value
-expandContext
-
-
remove
public T remove(javax.servlet.ServletRequest request, java.util.Map<java.lang.String,java.lang.Object> expandContext)
Based on name remove from ServletRequest or from List in ServletRequest- Parameters:
request
-expandContext
-- Returns:
- the removed value
-
remove
public T remove(javax.servlet.http.HttpSession session, java.util.Map<java.lang.String,java.lang.Object> expandContext)
Based on name remove from HttpSession or from List in HttpSession- Parameters:
session
-expandContext
-- Returns:
- the removed value
-
hashCode
public int hashCode()
The equals and hashCode methods are implemented just case this object is ever accidently used as a Map key *- Overrides:
hashCode
in classjava.lang.Object
- Returns:
- the hashcode
-
equals
public boolean equals(java.lang.Object obj)
The equals and hashCode methods are implemented just case this object is ever accidently used as a Map key- Overrides:
equals
in classjava.lang.Object
- Parameters:
obj
-- Returns:
- whether this object is equal to the passed object
-
toString
public java.lang.String toString()
To be used for a string representation of the accessor, returns the original name.- Overrides:
toString
in classjava.lang.Object
- Returns:
- the name of this accessor
-
-