public abstract class Rule<R extends Rule>
extends java.lang.Object
implements java.lang.Comparable<R>
Matching relies heavily on variablized Path matching via Path.matches(String)
| 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.lang.String |
excludeOn |
protected java.util.List<Rule.RuleMatcher> |
includeMatchers
Method/path combinations that would cause this Rule to be included in the relevant processing.
|
protected java.lang.String |
includeOn |
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.util.List<Path> |
getAllExcludePaths() |
java.util.List<Path> |
getAllIncludePaths() |
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<Rule.RuleMatcher> |
getIncludeMatchers() |
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 RuleMatcher matches
|
R |
withExcludeOn(java.lang.String methodsAndOrPaths) |
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 methodsAndOrPaths) |
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 final java.util.List<Rule.RuleMatcher> includeMatchers
protected final java.util.List<Rule.RuleMatcher> excludeMatchers
protected final transient JSNode configMap
JSNode is used because it implements a case insensitive map without modifying the keysprotected java.lang.String name
protected int order
protected java.lang.String configStr
protected java.lang.String includeOn
protected java.lang.String excludeOn
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> getAllIncludePaths()
public java.util.List<Path> getAllExcludePaths()
public java.util.List<Rule.RuleMatcher> getIncludeMatchers()
public R withIncludeOn(Rule.RuleMatcher matcher)
public R withIncludeOn(java.lang.String methods, java.lang.String paths)
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 Pathspublic R withIncludeOn(java.lang.String methodsAndOrPaths)
public R withExcludeOn(java.lang.String methods, java.lang.String paths)
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 Pathspublic R withExcludeOn(Rule.RuleMatcher matcher)
matcher - the method/path combo to excludepublic R withExcludeOn(java.lang.String methodsAndOrPaths)
public 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 © 2021 Rocket Partners, LLC. All rights reserved.