Interface StoreMap

All Superinterfaces:
ComplexData, Map<String,TypedValue<?>>
All Known Implementing Classes:
StoreMapImpl

public interface StoreMap extends Map<String,TypedValue<?>>, ComplexData
This is the interface for a concrete value of Type.MAP objects. It implements a Map of String to TypedValue objects.

StoreMaps also have builder-esque fluent methods for specific types, the with() group of methods.

It inherits support for dot traversal find() from ComplexData

Like all ComplexData objects, StoreMap's can be mutable or not; a mutable copy can be made as needed.

  • Method Details

    • newMap

      static StoreMap newMap()
      Conanonical constrcutor for new StoreMap instances.
      Returns:
      empty store map.
    • mutableCopy

      StoreMap mutableCopy()
      Make deep copy of this map, ensuring it is mutable.
      Specified by:
      mutableCopy in interface ComplexData
      Returns:
      mutable copy of this map
    • asCellCollection

      default CellCollection asCellCollection()
      Return the contents of this map as a CellCollection.
      Returns:
      CellCollection
    • put

      default <T> TypedValue<?> put(String name, Type<T> typ, T value)
      Put a typed value.
      Type Parameters:
      T - the type of the incoming value
      Parameters:
      name - the key for this value
      typ - the {Type object
      value - the value of put put
      Returns:
      prior value associated with this key
    • with

      default StoreMap with(String name, TypedValue<?> val)
      Fluently add a StoreMap to this map
      Parameters:
      name - the key name
      val - the map
      Returns:
      this store map
    • with

      default StoreMap with(String name, boolean value)
      Fluently add a boolean value to this map
      Parameters:
      name - the key name
      value - boolean value
      Returns:
      this store map
    • with

      default StoreMap with(String name, char value)
      Fluently add a char value to this map
      Parameters:
      name - the key name
      value - the char value
      Returns:
      this store map
    • with

      default StoreMap with(String name, String value)
      Fluently add a String to this map
      Parameters:
      name - the key name
      value - the string
      Returns:
      this store map
    • with

      default StoreMap with(String name, long value)
      Fluently add a long to this map
      Parameters:
      name - the key name
      value - the long value
      Returns:
      this store map
    • with

      default StoreMap with(String name, int value)
      Fluently add an int value to this map
      Parameters:
      name - the key name
      value - the int value
      Returns:
      this store map
    • with

      default StoreMap with(String name, double value)
      Fluently add a double value to this map
      Parameters:
      name - the key name
      value - the double value
      Returns:
      this store map
    • with

      default StoreMap with(String name, byte[] value)
      Fluently add a byte array to this map
      Parameters:
      name - the key name
      value - the byte array value
      Returns:
      this store map
    • with

      default StoreMap with(String name, StoreMap value)
      Fluently add a StoreMap to this map
      Parameters:
      name - the key name
      value - the StoreMap to add
      Returns:
      this store map
    • with

      default StoreMap with(String name, StoreList value)
      Fluently add a StoreList to this map
      Parameters:
      name - the key name
      value - the StoreList value
      Returns:
      this store map
    • with

      default StoreMap with(Cell<?> cell)
      Fluently add a Cell to this map. The name will be used as the key name, the type/value pair will form the TypedValue.
      Parameters:
      cell - cell to add
      Returns:
      this store map
    • mapOf

      static StoreMap mapOf(String in) throws ComplexDataParseException
      Create a StoreMap by parsing the String. See mapOf(Reader) for a discussion of parsing issues.
      Parameters:
      in - the input String
      Returns:
      the store map that was parsed
      Throws:
      ComplexDataParseException - the parse exception
    • mapOf

      static StoreMap mapOf(Reader in) throws ComplexDataParseException
      Create a StoreMap by parsing from the Reader.

      Parse TCSon formatted maps.

      TCSon is a typed extension to JSON, with 'type:value' stanzas instead of just 'value' in JSON. Parsing of generic JSON is generally supported. However, you must take care to handle numerics properly:

      • fixed point literals which are between Integer.MAX_VALUE and Integer.MIN_VALUE are typed as Integers
      • fixed point literals which are between Long.MAX_VALUE and Long.MIN_VALUE are typed as Longs
      • floating point literals become Doubles
      • fixed point integer literals using the 'L' suffix are typed as Longs

      Also, null values are not allowed as cells, so JSON null values may require reprocessing.

      Single character strings become Strings, unless they are enclosed in a single quote, in which chase they become Characters

      Complex data objects which are output as via ComplexData.toString(boolean) will include type specification as needed to disambiguate values.

      Parameters:
      in - Reader. Needs to be UTF-8 charset if you will be handling UTF characters.
      Returns:
      the store map that was parsed
      Throws:
      ComplexDataParseException - the parse exception
    • mapOf

      static StoreMap mapOf(Iterable<? extends Cell<?>> cs)
      Create a map from a CellSet. Names of cells become keys, type/value pairs become values.
      Parameters:
      cs - the cell set
      Returns:
      the created store map