I have the following Scala/Play! code:
case class Tweet(from: String, text: String)
implicit val tweetReads = (
(JsPath \ "from_user_name").read[String] ~
(JsPath \ "text").read[String]) (Tweet.apply _)
I have several questions regarding the syntax and meaning of the above code:
- On what class/object is the
~
method invoked on? - What is the class/type of the argument to
Tweet.apply
?
edit 1: full source code:
package models
import play.api.libs.json._
import play.api.libs.json.util._
import play.api.libs.json.Reads._
import play.api.libs.json.Writes._
import play.api.libs.functional.syntax._
case class Tweet(from: String, text: String)
object Tweet {
implicit val tweetReads = (
(JsPath \ "from_user_name").read[String] ~
(JsPath \ "text").read[String])(Tweet.apply _)
implicit val tweetWrites = (
(JsPath \ "from").write[String] ~
(JsPath \ "text").write[String])(unlift(Tweet.unapply))
}