Class FlexibleServletAccessor<T>

java.lang.Object
org.apache.ofbiz.base.util.collections.FlexibleServletAccessor<T>
All Implemented Interfaces:
Serializable

public class FlexibleServletAccessor<T> extends Object implements 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:
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    protected static class 
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    The equals and hashCode methods are implemented just in case this object is ever accidently used as a Map key
    get(HttpSession session, Map<String,Object> expandContext)
    Based on name get from HttpSession or from List in HttpSession
    get(ServletRequest request, Map<String,Object> expandContext)
    Based on name get from ServletRequest or from List in ServletRequest
    int
    The equals and hashCode methods are implemented just case this object is ever accidently used as a Map key *
    protected void
    init(String name)
    Init.
    boolean
    Is empty boolean.
    void
    put(HttpSession session, T value, Map<String,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, Map<String,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.
    remove(HttpSession session, Map<String,Object> expandContext)
    Based on name remove from HttpSession or from List in HttpSession
    remove(ServletRequest request, Map<String,Object> expandContext)
    Based on name remove from ServletRequest or from List in ServletRequest
    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
  • Constructor Details

    • FlexibleServletAccessor

      public FlexibleServletAccessor(String name)
    • FlexibleServletAccessor

      public FlexibleServletAccessor(String name, String defaultName)
  • Method Details

    • init

      protected void init(String name)
      Init.
      Parameters:
      name - the name
    • isEmpty

      public boolean isEmpty()
      Is empty boolean.
      Returns:
      the boolean
    • get

      public T get(ServletRequest request, Map<String,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, Map<String,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, Map<String,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, Map<String,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, Map<String,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, Map<String,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 class Object
      Returns:
      the hashcode
    • equals

      public boolean equals(Object obj)
      The equals and hashCode methods are implemented just in case this object is ever accidently used as a Map key
      Overrides:
      equals in class Object
      Parameters:
      obj -
      Returns:
      whether this object is equal to the passed object
    • toString

      public String toString()
      To be used for a string representation of the accessor, returns the original name.
      Overrides:
      toString in class Object
      Returns:
      the name of this accessor