Package io.inversion
Class Rule<R extends Rule>
java.lang.Object
io.inversion.Rule<R>
- All Implemented Interfaces:
Comparable<R>
- Direct Known Subclasses:
AclRule,Action,Collection,Db,Endpoint
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 io.inversion.json.JSMapJSNodeis 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 StringAn optional querystring that will be applied to every request processed.protected 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 TypeMethodDescriptionvoidafterWiringComplete(io.inversion.context.Context context) protected voidintprotected voidList<io.inversion.utils.Path>List<io.inversion.utils.Path>protected List<Rule.RuleMatcher>Designed to allow subclasses to provide a default match behavior of no configuration was provided by the developer.getName()intgetOrder()io.inversion.utils.PathFind the first ordered Path that satisfies this method/path match.io.inversion.utils.PathbooleanCheck if the http method and path match this Rule.booleanCheck if the http method and path match this Rule.toString()withDescription(String description) withExcludeOn(Rule.RuleMatcher matcher) Don't select this Rule when RuleMatcher matcheswithExcludeOn(String... specs) withIncludeOn(Rule.RuleMatcher matcher) withIncludeOn(String... specs) withOrder(int order) withParams(List<Param> params)
-
Field Details
-
ALL_METHODS
-
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
protected final transient io.inversion.json.JSMap configMapJSNodeis 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. -
includeOn
An optional querystring that will be applied to every request processed. This is useful to force specific params on different endpoints/actions etc. -
excludeOn
-
description
-
params
-
-
Constructor Details
-
Rule
public Rule()
-
-
Method Details
-
afterWiringComplete
public void afterWiringComplete(io.inversion.context.Context context) -
checkLazyConfig
protected void checkLazyConfig() -
doLazyConfig
protected void doLazyConfig() -
getDefaultIncludeMatchers
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
-
match
public io.inversion.utils.Path match(String method, io.inversion.utils.Path path, boolean bidirectional) -
getAllIncludeMethods
-
getAllIncludePaths
-
getAllExcludePaths
-
getIncludeMatchers
-
withIncludeOn
-
withIncludeOn
-
withExcludeOn
Don't select this Rule when RuleMatcher matches- Parameters:
matcher- the method/path combo to exclude- Returns:
- this
-
withExcludeOn
-
getExcludeMatchers
-
getName
-
withName
-
withDescription
-
getDescription
-
getOrder
public int getOrder() -
withOrder
-
compareTo
- Specified by:
compareToin interfaceComparable<R extends Rule>
-
getParams
-
withParams
-
withParam
-
toString
-