Package com.spotify.apollo.route
Class RuleRouter<T>
- java.lang.Object
-
- com.spotify.apollo.route.RuleRouter<T>
-
- All Implemented Interfaces:
ApplicationRouter<T>
public class RuleRouter<T> extends Object implements ApplicationRouter<T>
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Collection<String>
getMethodsForValidRules(com.spotify.apollo.Request message)
Returns a collection of valid methods (such as GET and POST) for the URI of the provided request.List<T>
getRuleTargets()
Return a list of all target objects that this router handles.Optional<RuleMatch<T>>
match(com.spotify.apollo.Request message)
Match a request to a configured entity.static <T> RuleRouter<T>
of(Iterable<Rule<T>> rules)
Create a router from a list of rules.
-
-
-
Method Detail
-
match
public Optional<RuleMatch<T>> match(com.spotify.apollo.Request message) throws InvalidUriException
Description copied from interface:ApplicationRouter
Match a request to a configured entity. Throws InvalidUriException if the URI of the request is badly formated. Returns absence if there is no match.- Specified by:
match
in interfaceApplicationRouter<T>
- Parameters:
message
- The message to find the entity for- Throws:
InvalidUriException
-
getMethodsForValidRules
public Collection<String> getMethodsForValidRules(com.spotify.apollo.Request message)
Description copied from interface:ApplicationRouter
Returns a collection of valid methods (such as GET and POST) for the URI of the provided request. Will return an empty collection if nothing match the URI.- Specified by:
getMethodsForValidRules
in interfaceApplicationRouter<T>
- Parameters:
message
- The message to find the methods for
-
getRuleTargets
public List<T> getRuleTargets()
Description copied from interface:ApplicationRouter
Return a list of all target objects that this router handles.- Specified by:
getRuleTargets
in interfaceApplicationRouter<T>
- Returns:
- A list of all targets
-
of
public static <T> RuleRouter<T> of(Iterable<Rule<T>> rules)
Create a router from a list of rules.
-
-