Package org.forgerock.services.routing
Class RouteMatcher<R>
- java.lang.Object
-
- org.forgerock.services.routing.RouteMatcher<R>
-
- Type Parameters:
R
- The type of the request.
- Direct Known Subclasses:
DelegatingRouteMatcher
public abstract class RouteMatcher<R> extends Object
A matcher for evaluating whether a route matches the incoming request. Implementing class can either return aRouteMatch
, if the route matches, ornull
, if the route does not match, from theevaluate(Context, Object)
method.Implementing classes must implement both
equals(Object)
andhashCode()
methods as each instance of aRouteMatcher
will be used as the key for a route.
-
-
Constructor Summary
Constructors Constructor Description RouteMatcher()
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description abstract boolean
equals(Object o)
abstract RouteMatch
evaluate(Context context, R request)
Evaluates the request and determines whether it matches the route.abstract int
hashCode()
abstract String
idFragment()
The fragment of an API ID that this matcher provides.abstract String
toString()
Returns aString
representation of the route matcher.abstract <D> D
transformApi(D descriptor, ApiProducer<D> producer)
Transform the API Descriptor as appropriate for the parent router's view of the child routes.
-
-
-
Method Detail
-
evaluate
public abstract RouteMatch evaluate(Context context, R request)
Evaluates the request and determines whether it matches the route.- Parameters:
context
- The request context.request
- The request.- Returns:
- A
RouteMatch
, if the request matches the route, ornull
, if not.
-
toString
public abstract String toString()
Returns aString
representation of the route matcher.
-
idFragment
public abstract String idFragment()
The fragment of an API ID that this matcher provides.- Returns:
- A fragment of the API ID.
-
transformApi
public abstract <D> D transformApi(D descriptor, ApiProducer<D> producer)
Transform the API Descriptor as appropriate for the parent router's view of the child routes.- Type Parameters:
D
- The type of descriptor object.- Parameters:
descriptor
- The descriptor to be mutated.producer
- The API Descriptor producer.- Returns:
- The new descriptor object.
-
-