play.routes.compiler.templates

Helper methods used in the templates

Attributes

Members list

Value members

Concrete methods

def baseIdentifier(route: Route, index: Int): String

Generate a base identifier for the given route

Generate a base identifier for the given route

Attributes

def concatSep[T](seq: Seq[T], sep: String)(f: T => ScalaContent): Any

Encode the given String constant as a triple quoted String.

Encode the given String constant as a triple quoted String.

This will split the String at any $ characters, and use concatenation to concatenate a single $ String followed be the remainder, this is to avoid "possible missing interpolator" false positive warnings.

That is to say:

/foo/$id<[^/]+>

Will be encoded as:

 """/foo/""" + "$" + """id<[^/]+>"""

Attributes

def injectedControllerMethodCall(r: Route, ident: String, paramFormat: Parameter => String): String

Generate a controller method call for the given injected route

Generate a controller method call for the given injected route

Attributes

def invokerIdentifier(route: Route, index: Int): String

Generate a invoker object identifier for the given route

Generate a invoker object identifier for the given route

Attributes

def javascriptCall(route: Route, localNames: Map[String, String]): String

Generate the Javascript call

Generate the Javascript call

Attributes

Collect all the routes that apply to a single action that are not dead.

Collect all the routes that apply to a single action that are not dead.

Dead routes occur when two routes route to the same action with the same parameters. When reverse routing, this means the one reverse router, depending on the parameters, will return different URLs. But if they have the same parameters, or no parameters, then after the first one, the subsequent ones will be dead code, never matching.

This optimization not only saves on code generated, but since the body of the JavaScript router is a series of very long String concatenation, this is hard work on the typer, which can easily stack overflow.

Attributes

Generate the Javascript code for the parameter constraints.

Generate the Javascript code for the parameter constraints.

This generates the contents of an if statement in JavaScript, and is used for when multiple routes route to the same action but with different parameters. If there are no constraints, None will be returned.

Attributes

def listNames(route: Route): String

Extract the local names out from the route, as List. See PR#4244

Extract the local names out from the route, as List. See PR#4244

Attributes

def localNames(route: Route): String

Extract the local names out from the route

Extract the local names out from the route

Attributes

def markLines(routes: Rule*): String

Mark lines with source map information.

Mark lines with source map information.

Attributes

def reverseCall(route: Route, localNames: Map[String, String]): String

Generate the reverse call

Generate the reverse call

Attributes

def reverseLocalNames(route: Route, params: Seq[(Parameter, Int)]): Map[String, String]

Calculate the local names that need to be matched

Calculate the local names that need to be matched

Attributes

def reverseMatchParameters(params: Seq[(Parameter, Int)], annotateUnchecked: Boolean): String

Reverse parameters for matching

Reverse parameters for matching

Attributes

Generate the reverse parameter constraints

Generate the reverse parameter constraints

In routes like /dummy controllers.Application.dummy(foo = "bar") foo = "bar" is a constraint

Attributes

Calculate the parameters for the reverse route call for the given routes.

Calculate the parameters for the reverse route call for the given routes.

Attributes

Calculate the parameters for the javascript reverse route call for the given routes.

Calculate the parameters for the javascript reverse route call for the given routes.

Attributes

Generate the reverse route context

Generate the reverse route context

Attributes

def reverseSignature(routes: Seq[Route]): String

Generate the parameter signature for the reverse route call for the given routes.

Generate the parameter signature for the reverse route call for the given routes.

Attributes

Calculate the unique reverse constraints, and generate them using the given block

Calculate the unique reverse constraints, and generate them using the given block

Attributes

def routeBinding(route: Route): String

A route binding

A route binding

Attributes

def routeIdentifier(route: Route, index: Int): String

Generate a route object identifier for the given route

Generate a route object identifier for the given route

Attributes

def routerIdentifier(include: Include, index: Int): String

Generate a router object identifier

Generate a router object identifier

Attributes

def safeKeyword(keyword: String): String

Ensure that the given keyword doesn't clash with any of the keywords that Play is using, including Scala keywords.

Ensure that the given keyword doesn't clash with any of the keywords that Play is using, including Scala keywords.

Attributes

def tupleNames(route: Route): String

Extract the local names out from the route, as tuple. See PR#4244

Extract the local names out from the route, as tuple. See PR#4244

Attributes

Concrete fields

val Injector: String

The code to statically get the Play injector

The code to statically get the Play injector

Attributes

val cb: String
val ob: String
val scalaReservedWords: List[String]
val tq: String