com.rallyhealth.weepickle.v1.core

Members list

Type members

Classlikes

class Abort(msg: String) extends Exception

Throw this inside a Visitor's handler functions to fail the processing of JSON. The Facade just needs to provide the error message, and it is up to the driver to ensure it is wrapped with relevant parser-level information.

Throw this inside a Visitor's handler functions to fail the processing of JSON. The Facade just needs to provide the error message, and it is up to the driver to ensure it is wrapped with relevant parser-level information.

Attributes

Supertypes
class Exception
class Throwable
trait Serializable
class Object
trait Matchable
class Any
Show all
trait ArrVisitor[-T, +J] extends ObjArrVisitor[T, J]

Visits the elements of a json array.

Visits the elements of a json array.

Attributes

Supertypes
trait ObjArrVisitor[T, J]
class Object
trait Matchable
class Any
Known subtypes
class ArrDelegate[T, J]
class MapArrContext[T, V, Z]
class CallbackVisitor[T, J](delegate: Visitor[T, J])(callback: J => Unit) extends Delegate[T, J]

Notifies the callback of top-level results returned by the delegate visitor.

Notifies the callback of top-level results returned by the delegate visitor.

Useful from extracting return values from visitors that are used in side-effecting positions.

Attributes

Supertypes
class Delegate[T, J]
trait Visitor[T, J]
trait AutoCloseable
class Object
trait Matchable
class Any
Show all
trait FromInput

Input data, ready to push through a Visitor.

Input data, ready to push through a Visitor.

Attributes

Supertypes
class Object
trait Matchable
class Any
trait JsVisitor[-T, +J] extends Visitor[T, J]

A Visitor specialized to work with JSON types. Forwards the not-JSON-related methods to their JSON equivalents.

A Visitor specialized to work with JSON types. Forwards the not-JSON-related methods to their JSON equivalents.

Attributes

Supertypes
trait Visitor[T, J]
trait AutoCloseable
class Object
trait Matchable
class Any

Adds a JSON Pointer to exceptions thrown by the delegate Visitor.

Adds a JSON Pointer to exceptions thrown by the delegate Visitor.

JSON Pointer is standardized by RFC 6901 and commonly used by JSON Schema.

Useful for debugging failures. Adds ~10% overhead depending on the parser.

Attributes

See also
Supertypes
class Object
trait Matchable
class Any
Self type
object NoOpVisitor extends NoOpVisitor[Unit]

NoOpVisitor discards all JSON AST information.

NoOpVisitor discards all JSON AST information.

This is the simplest possible visitor. It could be useful for checking JSON for correctness (via parsing) without worrying about saving the data.

It will always return Unit on any successful parse, no matter the content.

Attributes

Companion
class
Supertypes
class NoOpVisitor[Unit]
trait Visitor[Any, Unit]
trait AutoCloseable
class Object
trait Matchable
class Any
Show all
Self type
class NoOpVisitor[J](returnValue: J) extends Visitor[Any, J]

Attributes

Companion
object
Supertypes
trait Visitor[Any, J]
trait AutoCloseable
class Object
trait Matchable
class Any
Known subtypes
object NoOpVisitor.type
object NullVisitor.type
object NullVisitor extends NoOpVisitor[Null]

Visitor returning null for all instances. Useful in combination with side-effecting visitors, since null is a valid subtype of AnyRef.

Visitor returning null for all instances. Useful in combination with side-effecting visitors, since null is a valid subtype of AnyRef.

Attributes

Supertypes
class NoOpVisitor[Null]
trait Visitor[Any, Null]
trait AutoCloseable
class Object
trait Matchable
class Any
Show all
Self type
sealed trait ObjArrVisitor[-T, +J]

Base class for visiting elements of json arrays and objects.

Base class for visiting elements of json arrays and objects.

Type parameters

J

output result of visiting elements (e.g. a json AST or side-effecting writer)

T

input result of visiting a child of this object or array. object or array builders will typically insert this value into their internal Map or Seq.

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
trait ArrVisitor[T, J]
class ArrDelegate[T, J]
class MapArrContext[T, V, Z]
trait ObjVisitor[T, J]
class MapObjContext[T, V, Z]
class ObjDelegate[T, J]
Show all
trait ObjVisitor[-T, +J] extends ObjArrVisitor[T, J]

Visits the elements of a json object.

Visits the elements of a json object.

Attributes

Supertypes
trait ObjArrVisitor[T, J]
class Object
trait Matchable
class Any
Known subtypes
class MapObjContext[T, V, Z]
class ObjDelegate[T, J]
object Platform

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
Platform.type
trait SimpleVisitor[-T, +J] extends Visitor[T, J]

A visitor that throws an error for all the visit methods which it does not define, letting you only define the handlers you care about.

A visitor that throws an error for all the visit methods which it does not define, letting you only define the handlers you care about.

Attributes

Supertypes
trait Visitor[T, J]
trait AutoCloseable
class Object
trait Matchable
class Any
Known subtypes
object StringVisitor.type
trait SimpleTo[T]
class CaseR[V]
class SingletonR[T]
trait TaggedFromTo[T]
class Leaf[T]
class Node[T]
trait TaggedTo[T]
class Leaf[T]
class Node[T]
class TupleNTo[V]
Show all
object StringVisitor extends SimpleVisitor[Nothing, Any]

Attributes

Supertypes
trait SimpleVisitor[Nothing, Any]
trait Visitor[Nothing, Any]
trait AutoCloseable
class Object
trait Matchable
class Any
Show all
Self type
class TransformException(val shortMsg: String, val jsonPointer: String, val index: Option[Long], val line: Option[Long], val col: Option[Long], val token: Option[String], cause: Throwable) extends Exception

Enriches an exception with parser-level information. This could be a problem with either the parsing or with the Visitor consuming the data.

Enriches an exception with parser-level information. This could be a problem with either the parsing or with the Visitor consuming the data.

Value parameters

col

column of text (if applicable) (1-indexed)

line

line of text (if applicable) (1-indexed)

shortMsg

free-text of what/where went wrong.

token

textual representation of the json token (if applicable)

Attributes

Supertypes
class Exception
class Throwable
trait Serializable
class Object
trait Matchable
class Any
Show all
trait Types

Basic functionality to be able to read and write objects. Kept as a trait so other internal files can use it, while also mixing it into the com.rallyhealth.weepickle.v1 package to form the public API.

Basic functionality to be able to read and write objects. Kept as a trait so other internal files can use it, while also mixing it into the com.rallyhealth.weepickle.v1 package to form the public API.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
object Util

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
Util.type
trait Visitor[-T, +J] extends AutoCloseable

Standard set of hooks weepickle uses to traverse over a structured data. A superset of the JSON, MessagePack, and Scala object hierarchies, since it needs to support efficiently processing all of them.

Standard set of hooks weepickle uses to traverse over a structured data. A superset of the JSON, MessagePack, and Scala object hierarchies, since it needs to support efficiently processing all of them.

Note that some parameters are un-set (-1) when not available; e.g. visitArray's length is not set when parsing JSON input (since it cannot be known up front) and the various index parameters are not set when traversing Scala object hierarchies.

When expecting to deal with a subset of the methods; it is common to forward the ones you don't care about to the ones you do; e.g. JSON visitors would forward all visitFloat32/visitInt/etc. methods to visitFloat64

Type parameters

J

the result of visiting elements (e.g. a json AST or side-effecting writer)

T

the result of ObjArrVisitor.subVisitor which is passed back into a ArrVisitor and ObjVisitor via ObjArrVisitor.visitValue. For example, this might be a weejson.Str that gets passed into an ObjVisitor that's building up a weejson.Obj to be returned on ObjVisitor.visitEnd. Often T will be the same type as J for visitors that return things, or else Any by visitors that do their work by side-effecting instead of returning J.

Attributes

See also
Companion
object
Supertypes
trait AutoCloseable
class Object
trait Matchable
class Any
Known subtypes
trait JsVisitor[T, J]
class NoOpVisitor[J]
object NoOpVisitor.type
object NullVisitor.type
trait SimpleVisitor[T, J]
object StringVisitor.type
trait SimpleTo[T]
class CaseR[V]
class SingletonR[T]
trait TaggedFromTo[T]
class Leaf[T]
class Node[T]
trait TaggedTo[T]
class Leaf[T]
class Node[T]
class TupleNTo[V]
trait To[T]
trait FromTo[T]
class Delegate[T, J]
class MapTo[T, V, Z]
class Delegate[T, J]
class CallbackVisitor[T, J]
class MapTo[T, V, Z]
Show all
object Visitor

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
Visitor.type