Package ninja
Class ReverseRouter
- java.lang.Object
-
- ninja.ReverseRouter
-
- All Implemented Interfaces:
WithControllerMethod<ReverseRouter.Builder>
public class ReverseRouter extends Object implements WithControllerMethod<ReverseRouter.Builder>
Reverse routing. Lookup the uri associated with a controller method.- Author:
- Joe Lauer (jjlauer)
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ReverseRouter.Builder
-
Constructor Summary
Constructors Constructor Description ReverseRouter(NinjaProperties ninjaProperties, Router router)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ReverseRouter.Builder
with(Class<?> controllerClass, String methodName)
Retrieves a the reverse route for this controllerClass and method.ReverseRouter.Builder
with(ControllerMethods.ControllerMethod controllerMethod)
Retrieves a the reverse route for a method referenced with Java-8 lambdas (functional method references).ReverseRouter.Builder
with(MethodReference methodRef)
Retrieves a the reverse route for the method reference (e.g.
-
-
-
Constructor Detail
-
ReverseRouter
@Inject public ReverseRouter(NinjaProperties ninjaProperties, Router router)
-
-
Method Detail
-
with
public ReverseRouter.Builder with(Class<?> controllerClass, String methodName)
Retrieves a the reverse route for this controllerClass and method.- Parameters:
controllerClass
- The controllerClass e.g. ApplicationController.classmethodName
- the methodName of the class e.g. "index"- Returns:
- A
Builder
allowing setting path placeholders and queryParam string parameters.
-
with
public ReverseRouter.Builder with(MethodReference methodRef)
Retrieves a the reverse route for the method reference (e.g. controller class and method name).- Parameters:
methodRef
- The reference to a method- Returns:
- A
Builder
allowing setting path placeholders and queryParam string parameters.
-
with
public ReverseRouter.Builder with(ControllerMethods.ControllerMethod controllerMethod)
Retrieves a the reverse route for a method referenced with Java-8 lambdas (functional method references).- Specified by:
with
in interfaceWithControllerMethod<ReverseRouter.Builder>
- Parameters:
controllerMethod
- The Java-8 style method reference such asApplicationController::index
.- Returns:
- A
Builder
allowing setting path placeholders and queryParam string parameters.
-
-