org.ofbiz.minilang.method
Class ContextAccessor<T>

java.lang.Object
  extended by org.ofbiz.minilang.method.ContextAccessor<T>

public class ContextAccessor<T>
extends java.lang.Object

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.


Field Summary
protected  FlexibleMapAccessor<T> fma
           
protected  java.lang.String name
           
 
Constructor Summary
ContextAccessor(java.lang.String name)
           
ContextAccessor(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(java.util.Map<java.lang.String,? extends java.lang.Object> theMap, MethodContext methodContext)
          Based on name get from Map or from List in Map
 T get(MethodContext methodContext)
          Based on name get from Map or from List in Map
 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(java.util.Map<java.lang.String,java.lang.Object> theMap, T value, MethodContext methodContext)
          Based on name put in Map or from List in Map; 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(MethodContext methodContext, T value)
          Based on name put in Map or from List in Map; 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(java.util.Map<java.lang.String,? extends java.lang.Object> theMap, MethodContext methodContext)
          Based on name remove from Map or from List in Map
 T remove(MethodContext methodContext)
          Based on name remove from Map or from List in Map
 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

fma

protected FlexibleMapAccessor<T> fma
Constructor Detail

ContextAccessor

public ContextAccessor(java.lang.String name)

ContextAccessor

public ContextAccessor(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(MethodContext methodContext)
Based on name get from Map or from List in Map


put

public void put(MethodContext methodContext,
                T value)
Based on name put in Map or from List in Map; 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.


remove

public T remove(MethodContext methodContext)
Based on name remove from Map or from List in Map


get

public T get(java.util.Map<java.lang.String,? extends java.lang.Object> theMap,
             MethodContext methodContext)
Based on name get from Map or from List in Map


put

public void put(java.util.Map<java.lang.String,java.lang.Object> theMap,
                T value,
                MethodContext methodContext)
Based on name put in Map or from List in Map; 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.


remove

public T remove(java.util.Map<java.lang.String,? extends java.lang.Object> theMap,
                MethodContext methodContext)
Based on name remove from Map or from List in Map


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

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

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