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 |
|---|---|
static java.util.SortedSet<java.lang.String> |
ALL_METHODS |
protected io.inversion.json.JSMap |
configMap
JSNode is used because it implements a case insensitive map without modifying the keys |
protected java.lang.String |
description |
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
An optional querystring that will be applied to every request processed.
|
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.
|
protected java.util.List<Param> |
params |
| Constructor and Description |
|---|
Rule() |
| Modifier and Type | Method and Description |
|---|---|
void |
afterWiringComplete(io.inversion.context.Context context) |
protected void |
checkLazyConfig() |
int |
compareTo(Rule a) |
protected void |
doLazyConfig() |
java.util.List<io.inversion.utils.Path> |
getAllExcludePaths() |
java.util.List<java.lang.String> |
getAllIncludeMethods() |
java.util.List<io.inversion.utils.Path> |
getAllIncludePaths() |
protected java.util.List<Rule.RuleMatcher> |
getDefaultIncludeMatchers()
Designed to allow subclasses to provide a default match behavior
of no configuration was provided by the developer.
|
java.lang.String |
getDescription() |
java.util.List<Rule.RuleMatcher> |
getExcludeMatchers() |
java.util.List<Rule.RuleMatcher> |
getIncludeMatchers() |
java.lang.String |
getName() |
int |
getOrder() |
java.util.List<Param> |
getParams() |
io.inversion.utils.Path |
match(java.lang.String method,
io.inversion.utils.Path path)
Find the first ordered Path that satisfies this method/path match.
|
io.inversion.utils.Path |
match(java.lang.String method,
io.inversion.utils.Path path,
boolean bidirectional) |
boolean |
matches(java.lang.String method,
io.inversion.utils.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() |
Rule |
withDescription(java.lang.String description) |
R |
withExcludeOn(Rule.RuleMatcher matcher)
Don't select this Rule when RuleMatcher matches
|
R |
withExcludeOn(java.lang.String spec) |
R |
withIncludeOn(Rule.RuleMatcher matcher) |
R |
withIncludeOn(java.lang.String spec) |
R |
withName(java.lang.String name) |
R |
withOrder(int order) |
R |
withParam(Param param) |
R |
withParams(java.util.List<Param> params) |
public static final java.util.SortedSet<java.lang.String> ALL_METHODS
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 io.inversion.json.JSMap 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 includeOn
protected java.lang.String excludeOn
protected java.lang.String description
protected java.util.List<Param> params
public void afterWiringComplete(io.inversion.context.Context context)
protected void checkLazyConfig()
protected void doLazyConfig()
protected java.util.List<Rule.RuleMatcher> getDefaultIncludeMatchers()
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,
io.inversion.utils.Path path)
method - the HTTP method to matchpath - the concrete path to matchpublic io.inversion.utils.Path match(java.lang.String method,
io.inversion.utils.Path path)
method - the HTTP method to matchpath - the concrete path to matchpublic io.inversion.utils.Path match(java.lang.String method,
io.inversion.utils.Path path,
boolean bidirectional)
public java.util.List<java.lang.String> getAllIncludeMethods()
public java.util.List<io.inversion.utils.Path> getAllIncludePaths()
public java.util.List<io.inversion.utils.Path> getAllExcludePaths()
public java.util.List<Rule.RuleMatcher> getIncludeMatchers()
public R withIncludeOn(Rule.RuleMatcher matcher)
public R withIncludeOn(java.lang.String spec)
public R withExcludeOn(Rule.RuleMatcher matcher)
matcher - the method/path combo to excludepublic R withExcludeOn(java.lang.String spec)
public java.util.List<Rule.RuleMatcher> getExcludeMatchers()
public java.lang.String getName()
public R withName(java.lang.String name)
public Rule withDescription(java.lang.String description)
public java.lang.String getDescription()
public int getOrder()
public R withOrder(int order)
public int compareTo(Rule a)
public java.util.List<Param> getParams()
public java.lang.String toString()
toString in class java.lang.ObjectCopyright © 2023 Rocket Partners, LLC. All rights reserved.