Package io.inversion
Class Rule<R extends Rule>
java.lang.Object
io.inversion.Rule<R>
- All Implemented Interfaces:
Comparable<R>
Matches against an HTTP method and URL path to determine if the object
should be included when processing the associated Request.
Matching relies heavily on variablized Path matching via Path.matches(String)
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final JSNodeJSNodeis used because it implements a case insensitive map without modifying the keysprotected Stringprotected final List<Rule.RuleMatcher>Method/path combinations that would cause this Rule to be excluded from the relevant processing.protected Stringprotected final List<Rule.RuleMatcher>Method/path combinations that would cause this Rule to be included in the relevant processing.protected Stringprotected final org.slf4j.Loggerprotected StringThe name used for configuration and debug purposes.protected intRules are always processed in sequence sorted by ascending order. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidintprotected voidprotected Rule.RuleMatcherDesigned to allow subclasses to provide a default match behavior of no configuration was provided by the developer.getName()intgetOrder()protected PathFind the first ordered Path that satisfies this method/path match.booleanCheck if the http method and path match this Rule.booleanCheck if the http method and path match this Rule.toString()withConfig(String queryString) withExcludeOn(Rule.RuleMatcher matcher) Don't select this Rule when RuleMatcher matcheswithExcludeOn(String methodsAndOrPaths) withExcludeOn(String methods, String paths) Don't select this Rule when any method and path match.withIncludeOn(Rule.RuleMatcher matcher) withIncludeOn(String methodsAndOrPaths) withIncludeOn(String methods, String paths) Select this Rule when any method and path match.withOrder(int order)
-
Field Details
-
log
protected final transient org.slf4j.Logger log -
includeMatchers
Method/path combinations that would cause this Rule to be included in the relevant processing. -
excludeMatchers
Method/path combinations that would cause this Rule to be excluded from the relevant processing. -
configMap
JSNodeis used because it implements a case insensitive map without modifying the keys -
name
The name used for configuration and debug purposes. -
order
protected int orderRules are always processed in sequence sorted by ascending order. -
configStr
-
includeOn
-
excludeOn
-
-
Constructor Details
-
Rule
public Rule()
-
-
Method Details
-
checkLazyConfig
public void checkLazyConfig() -
doLazyConfig
protected void doLazyConfig() -
getDefaultIncludeMatch
Designed to allow subclasses to provide a default match behavior of no configuration was provided by the developer.- Returns:
- the default include match "*","*"
-
matches
Check if the http method and path match this Rule.- Parameters:
method- the HTTP method to matchpath- the concrete path to match- Returns:
- true if the http method and path are included and not excluded
-
matches
Check if the http method and path match this Rule.- Parameters:
method- the HTTP method to matchpath- the concrete path to match- Returns:
- true if the http method and path are included and not excluded
-
match
Find the first ordered Path that satisfies this method/path match.- Parameters:
method- the HTTP method to matchpath- the concrete path to match- Returns:
- the first includeMatchers path to match when method also matches, null if no matches or excluded
-
getAllIncludePaths
-
getAllExcludePaths
-
getIncludeMatchers
-
withIncludeOn
-
withIncludeOn
Select this Rule when any method and path match.- Parameters:
methods- or more comma separated http method names, can be null to match on anypaths- each path can be one or more comma separated variableized Paths- Returns:
- this
-
withIncludeOn
-
withExcludeOn
Don't select this Rule when any method and path match.- Parameters:
methods- or more comma separated http method names, can be null to match on anypaths- each path can be one or more comma separated variableized Paths- Returns:
- this
-
withExcludeOn
Don't select this Rule when RuleMatcher matches- Parameters:
matcher- the method/path combo to exclude- Returns:
- this
-
withExcludeOn
-
getExcludeMatchers
-
getName
-
withName
-
getOrder
public int getOrder() -
withOrder
-
getConfigKeys
-
getConfig
-
getConfig
-
withConfig
-
compareTo
- Specified by:
compareToin interfaceComparable<R extends Rule>
-
toString
-