org.ofbiz.base.util.collections
Class FlexibleServletAccessor<T>

java.lang.Object
  extended by org.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
protected static class FlexibleServletAccessor.AttributeAccessor<T>
           
 
Field Summary
protected  java.lang.String attributeName
           
protected  boolean empty
           
protected  FlexibleMapAccessor<T> fma
           
protected  java.lang.String name
           
protected  boolean needsExpand
           
 
Constructor Summary
FlexibleServletAccessor(java.lang.String name)
           
FlexibleServletAccessor(java.lang.String name, java.lang.String defaultName)
           
 
Method Summary
 boolean equals(java.lang.Object obj)
          The equals and hashCode methods are imnplemented just case this object is ever accidently used as a Map key
 T get(HttpSession session, java.util.Map<java.lang.String,java.lang.Object> expandContext)
          Based on name get from HttpSession or from List in HttpSession
 T get(ServletRequest request, java.util.Map<java.lang.String,java.lang.Object> expandContext)
          Based on name get from ServletRequest or from List in ServletRequest
 int hashCode()
          The equals and hashCode methods are imnplemented just case this object is ever accidently used as a Map key *
protected  void init(java.lang.String name)
           
 boolean isEmpty()
           
 void put(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(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(HttpSession session, java.util.Map<java.lang.String,java.lang.Object> expandContext)
          Based on name remove from HttpSession or from List in HttpSession
 T remove(ServletRequest request, java.util.Map<java.lang.String,java.lang.Object> expandContext)
          Based on name remove from ServletRequest or from List in ServletRequest
 java.lang.String toString()
          To be used for a string representation of the accessor, returns the original name.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

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
Constructor Detail

FlexibleServletAccessor

public FlexibleServletAccessor(java.lang.String name)

FlexibleServletAccessor

public FlexibleServletAccessor(java.lang.String name,
                               java.lang.String defaultName)
Method Detail

init

protected void init(java.lang.String name)

isEmpty

public boolean isEmpty()

get

public T get(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 from
expandContext - the context to use for name expansion
Returns:
the object corresponding to this getter class

get

public T get(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(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(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(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(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 imnplemented just case this object is ever accidently used as a Map key *

Overrides:
hashCode in class java.lang.Object
Returns:
the hashcode

equals

public boolean equals(java.lang.Object obj)
The equals and hashCode methods are imnplemented just case this object is ever accidently used as a Map key

Overrides:
equals in class java.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 class java.lang.Object
Returns:
the name of this accessor