Class FlexibleMapAccessor<T>

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

public final class FlexibleMapAccessor<T> extends Object implements Serializable, IsEmpty
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:
  • Method Details

    • getInstance

      public static <T> FlexibleMapAccessor<T> getInstance(String original)
      Returns a FlexibleMapAccessor instance.
      Parameters:
      original - The original String expression
      Returns:
      A FlexibleMapAccessor instance
    • containsNestedExpression

      public boolean containsNestedExpression()
      Returns true if this FlexibleMapAccessor contains a nested expression.
      Returns:
      true if this FlexibleMapAccessor contains a nested expression
    • getOriginalName

      public String getOriginalName()
    • getIsAscending

      public boolean getIsAscending()
    • isEmpty

      public boolean isEmpty()
      Specified by:
      isEmpty in interface IsEmpty
    • get

      public T get(Map<String,? extends Object> base)
      Given the name based information in this accessor, get the value from the passed in Map. Supports LocalizedMaps by getting a String or Locale object from the base Map with the key "locale", or by explicit locale parameter.
      Parameters:
      base -
      Returns:
      the found value
    • get

      public T get(Map<String,? extends Object> base, Locale locale)
      Given the name based information in this accessor, get the value from the passed in Map. Supports LocalizedMaps by getting a String or Locale object from the base Map with the key "locale", or by explicit locale parameter. Note that the localization functionality is only used when the lowest level sub-map implements the LocalizedMap interface
      Parameters:
      base - Map to get value from
      locale - Optional locale parameter, if null will see if the base Map contains a "locale" key
      Returns:
      the found value
    • put

      public void put(Map<String,Object> base, T value)
      Given the name based information in this accessor, put the value in the passed 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.
      Parameters:
      base -
      value -
    • remove

      public T remove(Map<String,? extends Object> base)
      Given the name based information in this accessor, remove the value from the passed in Map.
      Parameters:
      base - the Map to remove from
      Returns:
      the object removed
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object