Package

com.rayrobdod.json

parser

Permalink

package parser

Contains the various built-in parsers

Most built-in parsers either parse a serialized form (json, cbor, csv), parse from a generic collection class (seq, map) or parse a class that conforms to a stereotype (case class)

Source
package.scala
Linear Supertypes
Content Hierarchy
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. parser
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. final class BsonParser extends Parser[String, CborValue, DataInput]

    Permalink

    A streaming parser for Bson values

    A streaming parser for Bson values

    This supports types 1 (Float), 2 (String), 3 (Document), 4 (Array), 8 (Boolean), 10 (Null), 16 (Int32) and 18 (Int64). Other types are unsupported.

    Version

    3.0

    See also

    http://bsonspec.org/

  2. final class CborParser extends Parser[CborValue, CborValue, DataInput]

    Permalink

    A parser that will decode cbor data.

    A parser that will decode cbor data.

    This does not support

    • complex values in map keys
    • most tags

    tags are handled via the tagMatcher constructor parameter. By default, it can handle tags (2,3,4,5,30,55799).

    Version

    3.1

    See also

    http://tools.ietf.org/html/rfc7049

  3. final class CountingReader extends AnyRef

    Permalink

    A class that wraps a Reader and provides both a single-char buffer and a count of how many characters have been read

    A class that wraps a Reader and provides both a single-char buffer and a count of how many characters have been read

    Since

    3.1

  4. final class CsvParser extends Parser[Int, String, CountingReader]

    Permalink

    A streaming decoder for csv data.

    A streaming decoder for csv data.

    This parser is lenient, in that it ignores trailing delimiters

    A CSV file is always two levels deep - a two dimensional array.

    Version

    3.1

  5. final class CsvWithHeaderParser extends Parser[StringOrInt, String, Iterable[Char]]

    Permalink

    A streaming decoder for csv data, where the first line of the csv data is a header row.

    A streaming decoder for csv data, where the first line of the csv data is a header row.

    This parser is lenient, in that it ignores trailing delimiters

    A CSV file is always two levels deep, an array of key-value mappings.

    Version

    3.1

  6. final class IdentityParser[V] extends Parser[Nothing, V, V]

    Permalink

    A 'parser' that echos the value provided in its parse method

    A 'parser' that echos the value provided in its parse method

    Somewhat useful to be the 'recursed' parser in cases where the 'root' parser has already decoded a value.

    Version

    3.0

  7. final class JsonParser extends Parser[StringOrInt, JsonValue, CountingReader]

    Permalink

    A streaming decoder for json data.

    A streaming decoder for json data. This parser is intended to be relatively strict.

    Version

    3.1

    See also

    http://json.org/

  8. final class MapParser[K, V] extends Parser[K, V, Map[K, V]]

    Permalink

    A parser that reads each key-value pair from a Map

    A parser that reads each key-value pair from a Map

    K

    the type of keys contained in the Map

    V

    the type of values contained in the Map

    Version

    3.0

  9. trait Parser[+Key, +Value, -Input] extends AnyRef

    Permalink

    An object that parses an input into a sequence of key-value pairs for the purpose of inserting those key-value pairs into a Builder

    An object that parses an input into a sequence of key-value pairs for the purpose of inserting those key-value pairs into a Builder

    Key

    the key types

    Value

    the primitive value types

    Input

    the input to the parser

    Since

    3.0

    See also

    com.rayrobdod.json.builder.Builder

  10. final class PiecewiseParser[+Key, +Value, -Input] extends Parser[Key, Value, Input]

    Permalink

    A parser which can be built piecewise

    A parser which can be built piecewise

    Key

    the key types

    Value

    the primitive value types

    Input

    the input to the parser

    Example:
    1. case class Foo(a:String, b:Seq[String], c:String)
      val fooParser = new PiecewiseParser[StringOrInt, String, Foo](
      	PiecewiseParser.primitiveKeyDef("a", {x => x.a}),
      	PiecewiseParser.complexKeyDef("b", {x => x.b}, new PrimitiveSeqParser[String].mapKey[StringOrInt]),
      	PiecewiseParser.optionalKeyDef(PiecewiseParser.primitiveKeyDef("c", {x => x.c}), {x => x.c != ""})
      )
      val jsonBuilder = new PrettyJsonBuilder(PrettyJsonBuilder.MinifiedPrettyParams).mapValue[String]
      fooParser.parse(jsonbuilder, Foo("", Seq.empty, ""))
      // results in `{"a":"","b":[]}`
      fooParser.parse(jsonbuilder, Foo("qwer", Seq("z","x","c"), "asdf"))
      // results in `{"a":"qwer","b":["z","x","c"],"c":"asdf"}`
    Since

    3.0

  11. final class PrimitiveSeqParser[V] extends Parser[Int, V, Seq[V]]

    Permalink

    A parser that reads each Value and its index from a Seq

    A parser that reads each Value and its index from a Seq

    V

    the type of values contained in the Seq

    Version

    3.0

  12. final class RecursiveMapParser[K, V] extends Parser[K, V, RecursiveSubjectType[K, V]]

    Permalink

    A parser that can parse the results of recursive MapBuilder builds

    A parser that can parse the results of recursive MapBuilder builds

    K

    the type of keys contained in the Map

    V

    the primitive values contained in the Map

    Since

    3.1

  13. final class SeqParser[+K, +V, -Inner] extends Parser[K, V, Seq[Inner]]

    Permalink

    A parser that reads and parses each Value and its index from a Seq

    A parser that reads and parses each Value and its index from a Seq

    K

    the type of key used by recurse

    V

    the type of primitiveValue used by recurse

    Inner

    the type of values contained in the Seq

    Version

    3.0

Value Members

  1. object CborParser

    Permalink

    Objects related to Cbor's data model

    Objects related to Cbor's data model

    Version

    3.0

  2. object CsvParser

    Permalink

    Contains classes used to customize the CsvParser's behavior, as well as a few common instances of those classes.

    Contains classes used to customize the CsvParser's behavior, as well as a few common instances of those classes.

    Version

    3.0.1

    Since

    2.0

  3. object IdentityParser

    Permalink

    IdentityParser factory methods

    IdentityParser factory methods

    Since

    3.1

  4. object PiecewiseParser

    Permalink

    KeyDef and implementations

    KeyDef and implementations

    Since

    3.0

  5. object PrimitiveSeqParser

    Permalink

Inherited from AnyRef

Inherited from Any

Ungrouped