Package

com.twitter.util

routing

Permalink

package routing

Visibility
  1. Public
  2. All

Type Members

  1. abstract class AbstractRouter[Input, Route] extends Router[Input, Route]

    Permalink

    Java-friendly version of Router

    Java-friendly version of Router

    Input

    The Input type used to determine a route destination

    Route

    The output/resulting route type

  2. case class ClosedRouterException(router: Router[_, _]) extends RuntimeException with NoStackTrace with Product with Serializable

    Permalink

    Exception thrown when an attempt to route an Input to a Router where close() has been initiated on the Router.

    Exception thrown when an attempt to route an Input to a Router where close() has been initiated on the Router.

    router

    The Router where close() has already been initiated.

  3. abstract class Generator[Input, Route, +RouterType <: Router[Input, Route]] extends (String, Iterable[Route]) ⇒ RouterType

    Permalink

    Functional alias for creating a router given a label and all of the defined routes for the router to be generated.

  4. trait Router[Input, +Route] extends (Input) ⇒ Option[Route] with ClosableOnce with Logging

    Permalink

    A generic interface for routing an input to an optional matching route.

    A generic interface for routing an input to an optional matching route.

    Input

    The Input type used when determining a route destination

    Route

    The resulting route type. A Route may have dynamic properties and may be found to satisfy multiple Input instances. As there may not be a 1-to-1 mapping of Input to Route, it is encouraged that a Route encapsulates its relationship to an Input. An example to consider would be an HTTP Router. An HTTP request contains a Method (i.e. GET, POST) and a URI. A Router for a REST API may match "GET /users/{id}" for multiple HTTP requests (i.e. "GET /users/123" AND "GET /users/456" would map to the same destination Route). As a result, the Route in this example should be aware of the method, path, and and the destination/logic responsible for handling an Input that matches. Another property to consider for a Route is "uniqueness". It may or may not be desirable for a Router to contain multiple routes that correspond to the same Input.

    Note

    A Router should be considered immutable unless explicitly noted.

  5. case class RouterBuilder[Input, Route, +RouterType <: Router[Input, Route]] extends Product with Serializable

    Permalink

    Utility for building and creating routers.

    Utility for building and creating routers. The resulting router should be considered immutable, unless the router's implementation explicitly states otherwise.

    Input

    The router's Input type.

    Route

    The router's destination Route type. It is recommended that the Route is a self-contained/self-describing type for the purpose of validation via the validator. Put differently, the Route should know of the Input that maps to itself.

    RouterType

    The type of Router to build.

  6. case class ValidationError(msg: String) extends Product with Serializable

    Permalink

    Container class for an error that is encountered as part of validating routes via a RouteBuilder.

    Container class for an error that is encountered as part of validating routes via a RouteBuilder.

    msg

    The message that explains the error.

  7. case class ValidationException extends Exception with Product with Serializable

    Permalink

    Exception thrown when a RouterBuilder observes any routes that are not valid for the Router type it is building.

  8. abstract class Validator[-Route] extends (Iterable[Route]) ⇒ Iterable[ValidationError]

    Permalink

    Functional alias for determining whether all defined results are valid for a specific router type.

Value Members

  1. object Generator

    Permalink
  2. object RouterBuilder extends Serializable

    Permalink
  3. object Validator

    Permalink

Ungrouped