Class Route<T>

java.lang.Object
com.codingchili.core.protocol.Route<T>
Type Parameters:
T - type of the handler to handle the route.

public class Route<T> extends Object
Models a route in the Protocol.
  • Constructor Details

  • Method Details

    • getRoute

      public String getRoute()
    • setRoute

      public Route<T> setRoute(String route)
      Parameters:
      route - Route(String, RequestHandler, RoleType...)
      Returns:
      fluent
    • getDescription

      public String getDescription()
      Returns:
      a description of this route.
    • setDescription

      public Route<T> setDescription(String description)
      Parameters:
      description - a text description of this route.
      Returns:
      fluent
    • getRoles

      public RoleType[] getRoles()
      Returns:
      a list of roles that are authorized to invoke the endpoint.
    • setRoles

      public Route<T> setRoles(Role... roles)
      Parameters:
      roles - a list of roles that are allowed access to this api.
      Returns:
      fluent
    • getHandler

      public RequestHandler<T> getHandler()
      Returns:
      the handler that is invoked by the request processor when the request route matches this route in the protocol.
    • setHandler

      public Route<T> setHandler(RequestHandler<T> handler)
      Parameters:
      handler - see getHandler()
      Returns:
      fluent.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • setTemplate

      public Route<T> setTemplate(Class<?> template)
      Parameters:
      template - the class template to generate a text description of.
      Returns:
      fluent
    • setModel

      public Route<T> setModel(Map<String,​String> model)
      Parameters:
      model - a map of key value pairs as attribute name and type, describes the input/output of the api method.
      Returns:
      fluent
    • getModel

      public Map<String,​String> getModel()
      Returns:
      a text representation of the object graph that the route expect as input.