Interface ComplexData

All Known Subinterfaces:
StoreList, StoreMap
All Known Implementing Classes:
StoreListImpl, StoreMapImpl

public interface ComplexData
Root interface for all ComplexData objects in the system, including StoreList, and StoreMap objects.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static class 
    Exception class for "dot" traversal parsing issues.
  • Method Summary

    Modifier and Type
    Method
    Description
    find(String dotSpec)
    Do a filtering find operation across this object based on the Dot Notation given.
    boolean
    Is this object empty?
    boolean
    Is this a mutable representation?
    Make a mutable deep copy of this complex data object.
    default boolean
    Not empty.
    Acquire a parse for a specific reader.
    Acquire a parser for a specific string
    int
    Size (number of elements) in this object.
    toString(boolean skipWhitespace)
    Generate a string representation of this object in the specified format, with the specified compactness.
  • Method Details

    • size

      int size()
      Size (number of elements) in this object.
      Returns:
      number of elements.
    • isEmpty

      boolean isEmpty()
      Is this object empty?
      Returns:
      true if empty.
    • notEmpty

      default boolean notEmpty()
      Not empty. Inverse of empty. Sugar.
      Returns:
      true if not empty
    • isMutable

      boolean isMutable()
      Is this a mutable representation?
      Returns:
      true if mutable
    • toString

      String toString(boolean skipWhitespace)
      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.

      Parameters:
      skipWhitespace - line breaks and indention, or not.
      Returns:
      String version of this object.
    • find

      TypedValueSelection find(String dotSpec)
      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.

      Parameters:
      dotSpec - dot specification
      Returns:
      Selection of matching TypedValue
    • parser

      static ComplexDataParser parser(Reader in)
      Acquire a parse for a specific reader.
      Parameters:
      in - Reader for input
      Returns:
      parser
    • parser

      static ComplexDataParser parser(String in)
      Acquire a parser for a specific string
      Parameters:
      in - String
      Returns:
      parser.
    • mutableCopy

      ComplexData mutableCopy()
      Make a mutable deep copy of this complex data object.
      Returns:
      mutable copy.