Class ComplexDataParser

java.lang.Object
com.terracottatech.store.definition.ComplexDataParser

public class ComplexDataParser extends Object
This class can be used to parse ComplexData objects.

Given a String or reader as input, it can parse either a StoreList, a StoreMap, or a KeyedCellCollection object. When parsing keyed cell collections, either an untyped key can be parsed, or the expected key type can be specified.

  • Constructor Details

    • ComplexDataParser

      public ComplexDataParser(Reader reader)
      Instantiate a CDT parser over a reader. The Reader MUST be UTF charset capable if you are to handle UTF characters.
      Parameters:
      reader - Reader
    • ComplexDataParser

      public ComplexDataParser(String string)
      Instantiate a parser over a string.
      Parameters:
      string - String to parser
  • Method Details

    • nextMap

      public StoreMap nextMap() throws ComplexDataParseException
      Parse the next StoreMap from the input source.
      Returns:
      StoreMap or null on end of input.
      Throws:
      ComplexDataParseException
    • nextList

      public StoreList nextList() throws com.terracottatech.tcson.parser.ParseException
      Parse the next StoreList from the input source.
      Returns:
      StoreList or null on end of input.
      Throws:
      ComplexDataParseException
      com.terracottatech.tcson.parser.ParseException
    • nextKeyedCellCollection

      public <K extends Comparable<K>> KeyedCellCollection<K> nextKeyedCellCollection(Type<K> expectedKeyType) throws ComplexDataParseException
      Parse the next keyed complex map, with an expected key type, from the input source.
      Parameters:
      expectedKeyType - expected key type.
      Returns:
      a mutable keyed complex map or null on end of input.
      Throws:
      ComplexDataParseException
    • nextKeyedCellCollection

      public KeyedCellCollection<?> nextKeyedCellCollection() throws ComplexDataParseException
      Parse the next keyed complex map, with an unknown key type, from the input source.
      Returns:
      a mutable keyed complex map or null on end of input.
      Throws:
      ComplexDataParseException
    • reset

      public void reset(Reader reader)
      Reset the parser to use the specified Reader as an input source.
      Parameters:
      reader - Reader to use
    • reset

      public void reset(String string)
      Reset the parser to use the specified Reader as an input source.
      Parameters:
      string - String to use