Class StoreMapImpl

java.lang.Object
com.terracottatech.store.definition.StoreMapImpl
All Implemented Interfaces:
ComplexData, StoreMap, Map<String,TypedValue<?>>

public class StoreMapImpl extends Object implements StoreMap
  • Constructor Details

    • StoreMapImpl

      public StoreMapImpl(Map<String,TypedValue<?>> incoming)
    • StoreMapImpl

      public StoreMapImpl(com.terracottatech.tcson.ReadableSonMap rmap)
    • StoreMapImpl

      public StoreMapImpl(com.terracottatech.tcson.MutableSonMap mutable)
    • StoreMapImpl

      public StoreMapImpl(com.terracottatech.tcson.MutableSonMap map, boolean mutable)
    • StoreMapImpl

      public StoreMapImpl()
  • Method Details

    • find

      public TypedValueSelection find(String dotSpec)
      Description copied from interface: ComplexData
      Do a filtering find operation across this object based on the Dot Notation given.

      Dot notation is fairly simple yet powerful.

      • '.' by itself matches the current object.
      • '.foo' if the top level object is a map, matches the value of the 'foo' key
      • '.foo.bar' matches the top level object as a map, then the value at key 'foo', then matches if that value is a map, then matches the value of its key 'bar'. etc.
      • map keys for matching can also be expressed with more explicit
        • '.[foo bar].[baz]'
        • '.["foo\nbar"].baz'
      • '.[1]' matches the list entry at index 1 (lists are zero based)
      • '.[1:3]' matches the slice from 1 to 3 inclusive.
      • finally, a stanza of '.[].' matches all entries. (wildcard)

      This allows for reaching inside a nested complex structure and identifying only those pieces of interest. For example: '.employees.[].[first name]' might reach into a map, grab the list at key 'employees', go through every entry in the list, treat as a map, then grab the value of the 'first name' key in each map, this returning a list of every employee's first name.

      Specified by:
      find in interface ComplexData
      Parameters:
      dotSpec - dot specification
      Returns:
      Selection of matching TypedValue
    • mutableCopy

      public StoreMapImpl mutableCopy()
      Description copied from interface: StoreMap
      Make deep copy of this map, ensuring it is mutable.
      Specified by:
      mutableCopy in interface ComplexData
      Specified by:
      mutableCopy in interface StoreMap
      Returns:
      mutable copy of this map
    • isMutable

      public boolean isMutable()
      Description copied from interface: ComplexData
      Is this a mutable representation?
      Specified by:
      isMutable in interface ComplexData
      Returns:
      true if mutable
    • liveMap

      public com.terracottatech.tcson.SonMap<? extends com.terracottatech.tcson.SonMapValue> liveMap()
    • size

      public int size()
      Description copied from interface: ComplexData
      Size (number of elements) in this object.
      Specified by:
      size in interface ComplexData
      Specified by:
      size in interface Map<String,TypedValue<?>>
      Returns:
      number of elements.
    • isEmpty

      public boolean isEmpty()
      Description copied from interface: ComplexData
      Is this object empty?
      Specified by:
      isEmpty in interface ComplexData
      Specified by:
      isEmpty in interface Map<String,TypedValue<?>>
      Returns:
      true if empty.
    • containsKey

      public boolean containsKey(Object key)
      Specified by:
      containsKey in interface Map<String,TypedValue<?>>
    • containsValue

      public boolean containsValue(Object value)
      Specified by:
      containsValue in interface Map<String,TypedValue<?>>
    • get

      public TypedValue<?> get(Object key)
      Specified by:
      get in interface Map<String,TypedValue<?>>
    • put

      public TypedValue<?> put(String key, TypedValue<?> value)
      Specified by:
      put in interface Map<String,TypedValue<?>>
    • remove

      public TypedValue<?> remove(Object key)
      Specified by:
      remove in interface Map<String,TypedValue<?>>
    • putAll

      public void putAll(Map<? extends String,? extends TypedValue<?>> m)
      Specified by:
      putAll in interface Map<String,TypedValue<?>>
    • clear

      public void clear()
      Specified by:
      clear in interface Map<String,TypedValue<?>>
    • keySet

      public Set<String> keySet()
      Specified by:
      keySet in interface Map<String,TypedValue<?>>
    • values

      public Collection<TypedValue<?>> values()
      Specified by:
      values in interface Map<String,TypedValue<?>>
    • entrySet

      public Set<Map.Entry<String,TypedValue<?>>> entrySet()
      Specified by:
      entrySet in interface Map<String,TypedValue<?>>
    • toString

      public String toString(boolean skipWhitespace)
      Description copied from interface: ComplexData
      Generate a string representation of this object in the specified format, with the specified compactness.

      Native format is TC son, which is a more strongly typed version of JSON. Alternatively, the JSON compatible format grinds everything without a JSON type (chars, byte arrays) to strings, and all three numeric types become just JSON numbers.

      Specified by:
      toString in interface ComplexData
      Parameters:
      skipWhitespace - line breaks and indention, or not.
      Returns:
      String version of this object.
    • toString

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

      public boolean equals(Object o)
      Specified by:
      equals in interface Map<String,TypedValue<?>>
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Specified by:
      hashCode in interface Map<String,TypedValue<?>>
      Overrides:
      hashCode in class Object