com.rojoma.json.v3

util

package util

Visibility
  1. Public
  2. All

Type Members

  1. macro class AutomaticJsonCodec extends Annotation with StaticAnnotation

    Annotations
    @compileTimeOnly( ... )
  2. macro class AutomaticJsonDecode extends Annotation with StaticAnnotation

    Annotations
    @compileTimeOnly( ... )
  3. macro class AutomaticJsonEncode extends Annotation with StaticAnnotation

    Annotations
    @compileTimeOnly( ... )
  4. case class InternalTag(fieldName: String, removeTagForSubcodec: Boolean = true) extends TagType with Product with Serializable

    Specifies that the base codec should add (and possibly remove) an extra field to the objects generated by the subclasses' com.rojoma.json.v3.codec.JsonEncodes and com.rojoma.json.v3.codec.JsonDecodes (and they must be objects).

    Specifies that the base codec should add (and possibly remove) an extra field to the objects generated by the subclasses' com.rojoma.json.v3.codec.JsonEncodes and com.rojoma.json.v3.codec.JsonDecodes (and they must be objects).

    Example:
    1. abstract class Base
      case class SubclassA(name: String) extends Base
      case class SubclassB(x: Int, y: Int) extends Base
      
      implicit val aCodec = SimpleJsonCodecBuilder[SubclassA].build("name", _.name)
      implicit val bCodec = SimpleJsonCodecBuilder[SubclassB].build("x", _.x, "y", _.y)
      
      val baseCodec = SimpleHierarchyCodecBuilder[Base](InternalTag("type")).
         branch[SubclassA]("a").
         branch[SubclassB]("b").
         build
      
      println(baseCodec.encode(SubclassA("John"))) // { "type" : "a", "name" : "John" }
      println(baseCodec.encode(SubclassB(1, 2))) // { "type" : "b", "x" : 1, "y" : 2 }
  5. abstract class JArrayProducer extends AnyRef

  6. final class JValueProducer extends AnyRef

  7. class JsonKey extends Annotation with Annotation with ClassfileAnnotation

  8. class JsonKeyStrategy extends Annotation with Annotation with ClassfileAnnotation

  9. class JsonTag extends Annotation with Annotation with ClassfileAnnotation

  10. class LazyCodec extends Annotation with Annotation with ClassfileAnnotation

  11. sealed abstract class NoTag extends AnyRef

    Specifies that the base codec should not affect the subclasses' com.rojoma.json.v3.codec.JsonEncodes and com.rojoma.json.v3.codec.JsonDecodes at all and that the decoder should simply try each codec in turn, in the order they were provided to the builder, until it finds one that succeeds.

    Specifies that the base codec should not affect the subclasses' com.rojoma.json.v3.codec.JsonEncodes and com.rojoma.json.v3.codec.JsonDecodes at all and that the decoder should simply try each codec in turn, in the order they were provided to the builder, until it finds one that succeeds.

    Example:
    1. abstract class Base
      case class SubclassA(name: String) extends Base
      case class SubclassB(x: Int, y: Int) extends Base
      
      implicit val aCodec = SimpleJsonCodecBuilder[SubclassA].build("name", _.name)
      implicit val bCodec = SimpleJsonCodecBuilder[SubclassB].build("x", _.x, "y", _.y)
      
      val baseCodec = SimpleHierarchyCodecBuilder[Base](NoTag).
         branch[SubclassA].
         branch[SubclassB].
         build
      
      println(baseCodec.encode(SubclassA("John"))) // { "name" : "John" }
      println(baseCodec.encode(SubclassB(1, 2))) // { "x" : 1, "y" : 2 }
    See also

    com.rojoma.json.v3.util.TagType

  12. class NoTagSimpleHierarchyCodecBuilder[Root <: AnyRef] extends AnyRef

  13. class NoTagSimpleHierarchyDecodeBuilder[Root <: AnyRef] extends AnyRef

  14. class NoTagSimpleHierarchyEncodeBuilder[Root <: AnyRef] extends AnyRef

  15. class NullForNone extends Annotation with Annotation with ClassfileAnnotation

  16. class SimpleHierarchyCodecBuilder[Root <: AnyRef] extends AnyRef

  17. class SimpleHierarchyDecodeBuilder[Root <: AnyRef] extends AnyRef

  18. class SimpleHierarchyEncodeBuilder[Root <: AnyRef] extends AnyRef

  19. class Strategy extends Enum[Strategy]

  20. case class TagAndValue(typeField: String, valueField: String) extends TagType with Product with Serializable

    Specifies that the base codec should wrap the value generated by subclasses' com.rojoma.json.v3.codec.JsonEncodes and com.rojoma.json.v3.codec.JsonDecodes in another object containing two fields; one for the type-tag and one for the actual value.

    Specifies that the base codec should wrap the value generated by subclasses' com.rojoma.json.v3.codec.JsonEncodes and com.rojoma.json.v3.codec.JsonDecodes in another object containing two fields; one for the type-tag and one for the actual value.

    Example:
    1. abstract class Base
      case class SubclassA(name: String) extends Base
      case class SubclassB(x: Int, y: Int) extends Base
      
      implicit val aCodec = SimpleJsonCodecBuilder[SubclassA].build("name", _.name)
      implicit val bCodec = SimpleJsonCodecBuilder[SubclassB].build("x", _.x, "y", _.y)
      
      val baseCodec = SimpleHierarchyCodecBuilder[Base](TagAndValue("type", "value")).
         branch[SubclassA]("a").
         branch[SubclassB]("b").
         build
      
      println(baseCodec.encode(SubclassA("John"))) // { "type" : "a", "value" : { "name" : "John" } }
      println(baseCodec.encode(SubclassB(1, 2))) // { "type" : "b", "value" : { "x" : 1, "y" : 2 } }
  21. sealed abstract class TagType extends AnyRef

    Specifies the mechanism for distinguishing among subclasses in a hierarchy with a tag.

    Specifies the mechanism for distinguishing among subclasses in a hierarchy with a tag.

    See also

    com.rojoma.json.v3.util.NoTag

  22. final class WrappedCharArray extends AnyRef

    A container for a slice of an Array[Char] which promises to allow only read-only access to that array.

    A container for a slice of an Array[Char] which promises to allow only read-only access to that array. Note it does not itself copy the array, so if there is another reference the data can be mutated by other operations.

  23. class WrappedCharArrayIterator extends AbstractBufferedIterator[Char]

Value Members

  1. object AutomaticHierarchyCodecBuilder

  2. object AutomaticHierarchyDecodeBuilder

  3. object AutomaticHierarchyEncodeBuilder

  4. object AutomaticJsonCodecBuilder

  5. object AutomaticJsonDecodeBuilder

  6. object AutomaticJsonEncodeBuilder

  7. object JArrayProducer

  8. object JValueProducer

  9. object JsonArrayIterator

    Helper for reading lazily reading objects out of a source of JsonEvents representing a JSON array.

    Helper for reading lazily reading objects out of a source of JsonEvents representing a JSON array. Calling hasNext can throw any JsonLexException. Calling next() can throw any JSON lex or parse exception, or ElementDecodeException if the data in the array cannot be decoded as a T at that point. In the latter case, the iterator is still valid and positioned as if the decode had succeeded so it can continue to be used.

    returns

    An iterator of Ts

    Exceptions thrown
    JsonBadParse

    if alreadyInArray is false and the first event is not a StartOfArrayEvent

    JsonLexException

    if alreadyInArray is false and a lexing exception or EOF occurs.

  10. object JsonUtil

  11. object NoTag extends NoTag with Product with Serializable

  12. object SimpleHierarchyCodecBuilder

  13. object SimpleHierarchyDecodeBuilder

  14. object SimpleHierarchyEncodeBuilder

  15. object SimpleJsonCodecBuilder

  16. object TagToValue extends TagType with Product with Serializable

    Specifies that the base codec should wrap the value generated by subclasses' com.rojoma.json.v3.codec.JsonEncodes and com.rojoma.json.v3.codec.JsonDecodes in another object containing a single field, which is the tag for that subclass.

    Specifies that the base codec should wrap the value generated by subclasses' com.rojoma.json.v3.codec.JsonEncodes and com.rojoma.json.v3.codec.JsonDecodes in another object containing a single field, which is the tag for that subclass.

    Example:
    1. abstract class Base
      case class SubclassA(name: String) extends Base
      case class SubclassB(x: Int, y: Int) extends Base
      
      implicit val aCodec = SimpleJsonCodecBuilder[SubclassA].build("name", _.name)
      implicit val bCodec = SimpleJsonCodecBuilder[SubclassB].build("x", _.x, "y", _.y)
      
      val baseCodec = SimpleHierarchyCodecBuilder[Base](TagToValue).
         branch[SubclassA]("a").
         branch[SubclassB]("b").
         build
      
      println(baseCodec.encode(SubclassA("John"))) // { "a" : { "name" : "John" } }
      println(baseCodec.encode(SubclassB(1, 2))) // { "b" : { "x" : 1, "y" : 2 } }
  17. object WrappedCharArray

  18. object WrapperFieldCodec

  19. object WrapperFieldDecode

  20. object WrapperFieldEncode

  21. object WrapperJsonCodec

    Creates a combined com.rojoma.json.v3.codec.JsonEncode and com.rojoma.json.v3.codec.JsonDecode for a simple wrapper type.

    Creates a combined com.rojoma.json.v3.codec.JsonEncode and com.rojoma.json.v3.codec.JsonDecode for a simple wrapper type. The wrap function may throw IllegalArgumentException; this is translated to a com.rojoma.json.v3.codec.DecodeError.InvalidValue.

  22. object WrapperJsonDecode

    Creates a com.rojoma.json.v3.codec.JsonDecode for a simple wrapper type.

    Creates a com.rojoma.json.v3.codec.JsonDecode for a simple wrapper type. The wrap function may throw IllegalArgumentException; this is translated to a com.rojoma.json.v3.codec.DecodeError.InvalidValue.

  23. object WrapperJsonEncode

    Creates a com.rojoma.json.v3.codec.JsonEncode for a simple wrapper type.

Ungrouped