Class ComplexDataParser
java.lang.Object
com.terracottatech.store.definition.ComplexDataParser
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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Class for reading a sequence ofKeyedCellCollection
s from an input reader.static class
-
Constructor Summary
ConstructorsConstructorDescriptionComplexDataParser
(Reader reader) Instantiate a CDT parser over a reader.ComplexDataParser
(String string) Instantiate a parser over a string. -
Method Summary
Modifier and TypeMethodDescriptionParse the next keyed complex map, with an unknown key type, from the input source.<K extends Comparable<K>>
KeyedCellCollection<K>nextKeyedCellCollection
(Type<K> expectedKeyType) Parse the next keyed complex map, with an expected key type, from the input source.nextList()
Parse the next StoreList from the input source.nextMap()
Parse the next StoreMap from the input source.void
Reset the parser to use the specified Reader as an input source.void
Reset the parser to use the specified Reader as an input source.
-
Constructor Details
-
ComplexDataParser
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
Instantiate a parser over a string.- Parameters:
string
- String to parser
-
-
Method Details
-
nextMap
Parse the next StoreMap from the input source.- Returns:
- StoreMap or null on end of input.
- Throws:
ComplexDataParseException
-
nextList
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
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
Reset the parser to use the specified Reader as an input source.- Parameters:
reader
- Reader to use
-
reset
Reset the parser to use the specified Reader as an input source.- Parameters:
string
- String to use
-