What language construction is used here to create Action instance? I thought that in Scala it is possible to instantiate a class using:
- Direct constructor call:
new Action(params)
- Call
apply()
method of companion object (which usually calls constructor):Action(params)
But in the Scaladoc of Play! Action is see following snippet:
val echo = Action { request =>
Ok("Got request [" + request + "]")
}
What is called here? I understand that we create function request => response
, but where is this function passed?