object TypeTagOWrites
- Alphabetic
- By Inheritance
- TypeTagOWrites
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- def flat(tagOwrites: OWrites[String]): TypeTagOWrites
Encodes a tagged type by adding an extra field to the base
AJSON representation.Encodes a tagged type by adding an extra field to the base
AJSON representation.For instance, consider the following type definition:
sealed trait Foo case class Bar(s: String, i: Int) extends Foo case object Baz extends Foo
And also:
implicit val fooOWrites: OWrites[Foo] = derived.flat.owrites((__ \ "type").write)
The JSON representation of
Bar("quux", 42)is then the following JSON object:{ "type": "Bar", "s": "quux", "i": 42 }An important edge case will happen if a case class we are deriving for has its own
Writesthat does not produce aJsObject(likeJson.valueFormat), in this case we will synthesize a wrapper on-the-fly. See the tests and SyntheticWrapper.- tagOwrites
A way to encode the type tag as a JSON object (whose fields will be merged with the base JSON representation)
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- val nested: TypeTagOWrites
Encodes a tagged type by creating a JSON object wrapping the actual
AJSON representation.Encodes a tagged type by creating a JSON object wrapping the actual
AJSON representation. This wrapper is an object with just one field whose name is the type tag.For instance, consider the following type definition:
sealed trait Foo case class Bar(s: String, i: Int) extends Foo case object Baz extends Foo
The JSON representation of
Bar("quux", 42)is the following JSON object:{ "Bar": { "s": "quux", "i": 42 } } - final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()