final class ReaderSyntax extends AnyVal
- Source
- ReaderSyntax.scala
- Alphabetic
- By Inheritance
- ReaderSyntax
- AnyVal
- Any
- Hide All
- Show All
- Public
- Protected
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- Any
- final def ##: Int
- Definition Classes
- Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- Any
- def as[A](implicit reader: Reader[A]): A
Given that an implicit reader of type
Ais in scope It will deserialize the org.json4s.JValue to an object of typeAGiven that an implicit reader of type
Ais in scope It will deserialize the org.json4s.JValue to an object of typeAExample:
case class Person(name: String) implicit object PersonReader extends Reader[Person] { def read(json: JValue): Person = Person((json \ "name").extract[String]) } JObject(JField("name", JString("Joe")) :: Nil).as[Person]
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def getAs[A](implicit reader: Reader[A]): Option[A]
Given that an implicit reader of type
Ais in scope It will deserialize the org.json4s.JValue to an object of type Option[A]Given that an implicit reader of type
Ais in scope It will deserialize the org.json4s.JValue to an object of type Option[A]Example:
case class Person(name: String) implicit object PersonReader extends Reader[Person] { def read(json: JValue): Person = Person((json \ "name").extract[String]) } JObject(JField("name", JString("Joe")) :: Nil).getAs[Person]
- def getAsOrElse[A](default: => A)(implicit reader: Reader[A]): A
Given that an implicit reader of type
Ais in scope It will deserialize the org.json4s.JValue to an object of typeAif an error occurs it will return the default value.Given that an implicit reader of type
Ais in scope It will deserialize the org.json4s.JValue to an object of typeAif an error occurs it will return the default value.Example:
case class Person(name: String) implicit object PersonReader extends Reader[Person] { def read(json: JValue): Person = Person((json \ "name").extract[String]) } JObject(JField("name", JString("Joe")) :: Nil).getAsOrElse(Person("Tom"))
- def getClass(): Class[_ <: AnyVal]
- Definition Classes
- AnyVal → Any
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def toString(): String
- Definition Classes
- Any