Class FlexibleMapAccessor<T>

  • All Implemented Interfaces:
    java.io.Serializable, IsEmpty

    public final class FlexibleMapAccessor<T>
    extends java.lang.Object
    implements java.io.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:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String module  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean containsNestedExpression()
      Returns true if this FlexibleMapAccessor contains a nested expression.
      boolean equals​(java.lang.Object obj)  
      T get​(java.util.Map<java.lang.String,​? extends java.lang.Object> base)
      Given the name based information in this accessor, get the value from the passed in Map.
      T get​(java.util.Map<java.lang.String,​? extends java.lang.Object> base, java.util.Locale locale)
      Given the name based information in this accessor, get the value from the passed in Map.
      static <T> FlexibleMapAccessor<T> getInstance​(java.lang.String original)
      Returns a FlexibleMapAccessor instance.
      boolean getIsAscending()  
      java.lang.String getOriginalName()  
      int hashCode()  
      boolean isEmpty()  
      void put​(java.util.Map<java.lang.String,​java.lang.Object> base, T value)
      Given the name based information in this accessor, put the value in the passed in Map.
      T remove​(java.util.Map<java.lang.String,​? extends java.lang.Object> base)
      Given the name based information in this accessor, remove the value from the passed in Map.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • module

        public static final java.lang.String module
    • Method Detail

      • getInstance

        public static <T> FlexibleMapAccessor<T> getInstance​(java.lang.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 java.lang.String getOriginalName()
      • getIsAscending

        public boolean getIsAscending()
      • isEmpty

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

        public T get​(java.util.Map<java.lang.String,​? extends java.lang.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​(java.util.Map<java.lang.String,​? extends java.lang.Object> base,
                     java.util.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​(java.util.Map<java.lang.String,​java.lang.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​(java.util.Map<java.lang.String,​? extends java.lang.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 java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object