Package com.codingchili.core.protocol
Class Route<T>
java.lang.Object
com.codingchili.core.protocol.Route<T>
- Type Parameters:
T
- type of the handler to handle the route.
Models a route in the Protocol.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetModel()
RoleType[]
getRoles()
getRoute()
int
hashCode()
setDescription(String description)
setHandler(RequestHandler<T> handler)
setTemplate(Class<?> template)
-
Constructor Details
-
Route
public Route()Empty constructor for serialization support, the handler is not serialized. -
Route
- Parameters:
route
-Route(String, RequestHandler, RoleType...)
-
Route
- Parameters:
route
-Route(String, RequestHandler, RoleType...)
handler
-Route(String, RequestHandler, RoleType...)
-
Route
- Parameters:
route
- a text representation of where this route is mounted at, relative to the target handler.handler
- the handler to be invoked when the route matches an incoming request.role
- a set of roles that have access to this route.
-
-
Method Details
-
getRoute
-
setRoute
- Parameters:
route
-Route(String, RequestHandler, RoleType...)
- Returns:
- fluent
-
getDescription
- Returns:
- a description of this route.
-
setDescription
- Parameters:
description
- a text description of this route.- Returns:
- fluent
-
getRoles
- Returns:
- a list of roles that are authorized to invoke the endpoint.
-
setRoles
- Parameters:
roles
- a list of roles that are allowed access to this api.- Returns:
- fluent
-
getHandler
- Returns:
- the handler that is invoked by the request processor when the request route matches this route in the protocol.
-
setHandler
- Parameters:
handler
- seegetHandler()
- Returns:
- fluent.
-
hashCode
public int hashCode() -
setTemplate
- Parameters:
template
- the class template to generate a text description of.- Returns:
- fluent
-
setModel
- Parameters:
model
- a map of key value pairs as attribute name and type, describes the input/output of the api method.- Returns:
- fluent
-
getModel
- Returns:
- a text representation of the object graph that the route expect as input.
-