RegexPathSpec is a PathSpec implementation for a PathMappings instance.
Supports the standard Java regex found in java..
Supports PathSpecGroup for PathSpecGroup#EXACT, PathSpecGroup#PREFIX_GLOB, PathSpecGroup#MIDDLE_GLOB, and PathSpecGroup#SUFFIX_GLOB.
This is done by evaluating the signature or the provided regex pattern for what is a literal vs a glob (of any kind).
PathSpecGroup#EXACT.PathSpecGroup#PREFIX_GLOBPathSpecGroup#SUFFIX_GLOBPathSpecGroup#MIDDLE_GLOB
The use of regex capture groups, regex character classes, regex quantifiers, and regex special contructs
will be identified as a glob (for signature determination), all other characters are identified
as literal. The regex ^ beginning of line, and regex $ end of line are ignored.
Support for MatchedPath and PathMatch vs PathInfo
There's a few steps in evaluating the matched input path for determining where the split
in the input path should occur for MatchedPath#getPathMatch() and MatchedPath#getPathInfo().
MatchedPath#getPathMatch(),
and a null returned for MatchedPath#getPathInfo()
name and info are present, then
the name group is returned in MatchedPath#getPathMatch() and the
info group is returned in MatchedPath#getPathInfo()
name is present, the
input path up to the end of the capturing group is returned
in MatchedPath#getPathMatch() and any following characters (or null)
are returned in MatchedPath#getPathInfo()
MatchedPath#getPathMatch() and any following characters (or null)
are returned in MatchedPath#getPathInfo()
/ AND the pathInfo doesn't start with /
then the slash is moved from pathMatch to pathInfo.
MatchedPath#getPathMatch(), and a null returned for MatchedPath#getPathInfo()
| Modifier and Type | Class and Description |
|---|---|
| private class |
| Modifier and Type | Field and Description |
|---|---|
| private final String | |
| private final PathSpecGroup | |
| private final int | |
| private final Pattern | |
| private final int | |
| private static final Map | |
| private static final Logger |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public String | getDeclaration()
Implements org. The as-provided path spec. |
| public PathSpecGroup | |
| protected Matcher | |
| public int | getPathDepth()
Implements org. Get the number of path elements that this path spec declares. |
| public String | getPathInfo(String
the path to match against path)Implements org. Return the portion of the path that is after the path spec. |
| public String | getPathMatch(String
the path to match against path)Implements org. Return the portion of the path that matches a path spec. |
| public Pattern | |
| public String | getPrefix()
Implements org. A simple prefix match for the pathspec or null |
| public int | getSpecLength()
Implements org. The length of the spec. |
| public String | getSuffix()
Implements org. A simple suffix match for the pathspec or null |
| public MatchedPath | matched(String
the path to test path)Implements org. Get the complete matched details of the provided path. |
| public boolean | matches(final String
the path to test path)Overrides default org. Test to see if the provided path matches this path spec. |
| _declaration | back to summary |
|---|---|
| private final String _declaration | |
| _group | back to summary |
|---|---|
| private final PathSpecGroup _group | |
| _pathDepth | back to summary |
|---|---|
| private final int _pathDepth | |
| _pattern | back to summary |
|---|---|
| private final Pattern _pattern | |
| _specLength | back to summary |
|---|---|
| private final int _specLength | |
| FORBIDDEN_ESCAPED | back to summary |
|---|---|
| private static final Map<Character, String> FORBIDDEN_ESCAPED | |
| LOG | back to summary |
|---|---|
| private static final Logger LOG | |
| RegexPathSpec | back to summary |
|---|---|
| public RegexPathSpec(String regex) | |
| getDeclaration | back to summary |
|---|---|
| public String getDeclaration() Implements org. Doc from org. The as-provided path spec. | |
| getGroup | back to summary |
|---|---|
| public PathSpecGroup getGroup() Implements org. Doc from org. The spec group.
| |
| getMatcher | back to summary |
|---|---|
| protected Matcher getMatcher(String path) | |
| getPathDepth | back to summary |
|---|---|
| public int getPathDepth() Implements org. Doc from org. Get the number of path elements that this path spec declares. This is used to determine longest match logic.
| |
| getPathInfo | back to summary |
|---|---|
| public String getPathInfo(String path) Implements org. Doc from org. Return the portion of the path that is after the path spec. | |
| getPathMatch | back to summary |
|---|---|
| public String getPathMatch(String path) Implements org. Doc from org. Return the portion of the path that matches a path spec. | |
| getPattern | back to summary |
|---|---|
| public Pattern getPattern() | |
| getPrefix | back to summary |
|---|---|
| public String getPrefix() Implements org. Doc from org. A simple prefix match for the pathspec or null | |
| getSpecLength | back to summary |
|---|---|
| public int getSpecLength() Implements org. Doc from org. The length of the spec.
| |
| getSuffix | back to summary |
|---|---|
| public String getSuffix() Implements org. Doc from org. A simple suffix match for the pathspec or null | |
| matched | back to summary |
|---|---|
| public MatchedPath matched(String path) Implements org. Doc from org. Get the complete matched details of the provided path.
| |
| matches | back to summary |
|---|---|
| public boolean matches(final String path) Overrides default org. Doc from org. Test to see if the provided path matches this path spec.
This can be more efficient that | |
| Modifier and Type | Field and Description |
|---|---|
| private final String | |
| private String | |
| private String | |
| private final RegexPathSpec |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| private void | |
| private int | |
| public String | getPathInfo()
Implements org. Return the portion of the path that is after the path spec. |
| public String | getPathMatch()
Implements org. Return the portion of the path that matches a path spec. |
| public String | |
| private String |
| path | back to summary |
|---|---|
| private final String path | |
| pathInfo | back to summary |
|---|---|
| private String pathInfo | |
| pathMatch | back to summary |
|---|---|
| private String pathMatch | |
| pathSpec | back to summary |
|---|---|
| private final RegexPathSpec pathSpec | |
| RegexMatchedPath | back to summary |
|---|---|
| public RegexMatchedPath(RegexPathSpec regexPathSpec, String path, Matcher matcher) | |
| calcPathMatchInfo | back to summary |
|---|---|
| private void calcPathMatchInfo(Matcher matcher) | |
| endOf | back to summary |
|---|---|
| private int endOf(Matcher matcher, String groupName) | |
| getPathInfo | back to summary |
|---|---|
| public String getPathInfo() Implements org. Doc from org. Return the portion of the path that is after the path spec.
| |
| getPathMatch | back to summary |
|---|---|
| public String getPathMatch() Implements org. Doc from org. Return the portion of the path that matches a path spec. | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object.
Satisfying this method's contract implies a non- | |
| valueOf | back to summary |
|---|---|
| private String valueOf(Matcher matcher, String groupName) | |