public abstract class Rule<R extends Rule>
extends java.lang.Object
implements java.lang.Comparable<R>
Matching relies heavily on variablized Path matching via io.inversion.Path.match
| Modifier and Type | Class and Description |
|---|---|
static class |
Rule.RuleMatcher |
| Modifier and Type | Field and Description |
|---|---|
protected JSNode |
configMap
JSNode is used because it implements a case insensitive map without modifying the keys |
protected java.lang.String |
configStr |
protected java.util.List<Rule.RuleMatcher> |
excludeMatchers
Method/path combinations that would cause this Rule to be excluded from the relevant processing.
|
protected java.util.List<Rule.RuleMatcher> |
includeMatchers
Method/path combinations that would cause this Rule to be included in the relevant processing.
|
protected org.slf4j.Logger |
log |
protected java.lang.String |
name
The name used for configuration and debug purposes.
|
protected int |
order
Rules are always processed in sequence sorted by ascending order.
|
| Constructor and Description |
|---|
Rule() |
| Modifier and Type | Method and Description |
|---|---|
void |
checkLazyConfig() |
int |
compareTo(Rule a) |
protected void |
doLazyConfig() |
java.lang.String |
getConfig(java.lang.String key) |
java.lang.String |
getConfig(java.lang.String key,
java.lang.String defaultValue) |
java.util.Set<java.lang.String> |
getConfigKeys() |
protected Rule.RuleMatcher |
getDefaultIncludeMatch()
Designed to allow subclasses to provide a default match behavior
of no configuration was provided by the developer.
|
java.util.List<Rule.RuleMatcher> |
getExcludeMatchers() |
java.util.List<Path> |
getExcludePaths() |
java.util.List<Rule.RuleMatcher> |
getIncludeMatchers() |
java.util.List<Path> |
getIncludePaths() |
java.lang.String |
getName() |
int |
getOrder() |
protected Path |
match(java.lang.String method,
Path path)
Find the first ordered Path that satisfies this method/path match.
|
boolean |
matches(java.lang.String method,
Path path)
Check if the http method and path match this Rule.
|
boolean |
matches(java.lang.String method,
java.lang.String path)
Check if the http method and path match this Rule.
|
java.lang.String |
toString() |
R |
withConfig(java.lang.String queryString) |
R |
withExcludeOn(Rule.RuleMatcher matcher)
Don't select this Rule when any method and path match.
|
R |
withExcludeOn(java.lang.String methods,
Path... paths) |
R |
withExcludeOn(java.lang.String methods,
java.lang.String... paths)
Don't select this Rule when any method and path match.
|
R |
withIncludeOn(Rule.RuleMatcher matcher) |
R |
withIncludeOn(java.lang.String methods,
Path... paths)
Select this Rule when any method and path match.
|
R |
withIncludeOn(java.lang.String methods,
java.lang.String... paths)
Select this Rule when any method and path match.
|
R |
withName(java.lang.String name) |
R |
withOrder(int order) |
protected final transient org.slf4j.Logger log
protected java.lang.String name
protected int order
protected java.util.List<Rule.RuleMatcher> includeMatchers
protected java.util.List<Rule.RuleMatcher> excludeMatchers
protected transient JSNode configMap
JSNode is used because it implements a case insensitive map without modifying the keysprotected java.lang.String configStr
public void checkLazyConfig()
protected void doLazyConfig()
protected Rule.RuleMatcher getDefaultIncludeMatch()
public boolean matches(java.lang.String method,
java.lang.String path)
method - the HTTP method to matchpath - the concrete path to matchpublic boolean matches(java.lang.String method,
Path path)
method - the HTTP method to matchpath - the concrete path to matchprotected Path match(java.lang.String method, Path path)
method - the HTTP method to matchpath - the concrete path to matchpublic java.util.List<Path> getIncludePaths()
public java.util.List<Path> getExcludePaths()
public java.util.List<Rule.RuleMatcher> getIncludeMatchers()
public R withIncludeOn(Rule.RuleMatcher matcher)
public R withIncludeOn(java.lang.String methods, java.lang.String... paths)
one - or more comma separated http method names, can be null to match on anypaths - each path can be one or more comma separated variableized Pathspublic R withIncludeOn(java.lang.String methods, Path... paths)
one - or more comma separated http method names, can be null to match on anypaths - each path can be one or more comma separated variableized Pathspublic R withExcludeOn(java.lang.String methods, java.lang.String... paths)
one - or more comma separated http method names, can be null to match on anypaths - each path can be one or more comma separated variableized Pathspublic R withExcludeOn(Rule.RuleMatcher matcher)
one - or more comma separated http method names, can be null to match on anypaths - each path can be one or more comma separated variableized Pathspublic java.util.List<Rule.RuleMatcher> getExcludeMatchers()
public java.lang.String getName()
public R withName(java.lang.String name)
public int getOrder()
public R withOrder(int order)
public java.util.Set<java.lang.String> getConfigKeys()
public java.lang.String getConfig(java.lang.String key)
public java.lang.String getConfig(java.lang.String key,
java.lang.String defaultValue)
public R withConfig(java.lang.String queryString)
public int compareTo(Rule a)
public java.lang.String toString()
toString in class java.lang.ObjectCopyright © 2024 Rocket Partners, LLC. All rights reserved.