public class PathMatcherImpl extends Object implements PathMatcher
PathMatcher
interface.Constructor and Description |
---|
PathMatcherImpl(String aPathPattern)
Constructs an ANT Path
Matcher , matching its ANT path pattern
against the path provided to the isMatching(String) method. |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
String |
getPathPattern()
Returns the path pattern being used by the
PathMatcher . |
String[] |
getWildcardNames()
Retrieves the list of wildcard names identifying the wildcards as
specified by the path pattern.
|
int |
hashCode() |
boolean |
isMatching(String aPath)
The this method applies the following rules from the configured ANT path
pattern to the path provided via
PathMatcher.isMatching(String) method:
A single asterisk ("*") matches zero or more characters within a path
name. |
String |
toPattern()
For debugging purposes, retrieve the regex pattern created from the ANT
path pattern.
|
String |
toWildcardReplacement(String aPath,
String aWildcardName)
Returns the wildcard substitute for the wildcards in your path pattern
(see
PathMatcher.getPathPattern() ) compared to the actual path
(as of PathMatcher.toWildcardSubstitutes(String) ). |
String |
toWildcardReplacementAt(String aPath,
int aIndex)
Returns the wildcard substitute for the wildcards in your path pattern
(see
PathMatcher.getPathPattern() ) compared to the actual path
(as of PathMatcher.toWildcardSubstitutes(String) ). |
String[] |
toWildcardReplacements(String aPath)
Returns an array of the wildcard substitutes for the wildcards in your
path pattern (see
PathMatcher.getPathPattern() ) compared to the
actual path (as of PathMatcher.toWildcardSubstitutes(String) ). |
String[] |
toWildcardReplacements(String aPath,
String... aWildcardNames)
Returns the wildcard substitutes for the wildcards in your path pattern
(see
PathMatcher.getPathPattern() ) compared to the actual path
(as of PathMatcher.toWildcardSubstitutes(String) ). |
String[] |
toWildcardReplacementsAt(String aPath,
int... aIndexes)
Returns the wildcard substitutes for the wildcards in your path pattern
(see
PathMatcher.getPathPattern() ) compared to the actual path
(as of PathMatcher.toWildcardSubstitutes(String) ). |
WildcardSubstitutes |
toWildcardSubstitutes(String aPath)
Returns all available wildcard substitutes as well as the named wildcard
substitutes.
|
public PathMatcherImpl(String aPathPattern)
Matcher
, matching its ANT path pattern
against the path provided to the isMatching(String)
method.
The Delimiter.PATH
is used as default path delimiter.
The PathMatcherImpl
applies the following rules from the ANT path
pattern to the path provided via isMatching(String)
method:
A single asterisk ("*") matches zero or more characters within a path
name. A double asterisk ("**") matches zero or more characters across
directory levels. A question mark ("?") matches exactly one character
within a path name.aPathPattern
- The pattern to be used when matching a path via
isMatching(String)
.public String[] getWildcardNames()
PathMatcher
getWildcardNames
in interface PathMatcher
public String getPathPattern()
PathMatcher
PathMatcher
.getPathPattern
in interface PathMatcher
public boolean isMatching(String aPath)
PathMatcher
PathMatcher.isMatching(String)
method:
A single asterisk ("*") matches zero or more characters within a path
name. A double asterisk ("**") matches zero or more characters across
directory levels. A question mark ("?") matches exactly one character
within a path nameisMatching
in interface Matcher<String>
isMatching
in interface PathMatcher
aPath
- the a pathpublic WildcardSubstitutes toWildcardSubstitutes(String aPath)
PathMatcher
toWildcardSubstitutes
in interface PathMatcher
aPath
- The path for which to retrieve the wildcard substitutes.WildcardSubstitutes
of the wildcards being
substituted.public String[] toWildcardReplacements(String aPath)
PathMatcher
PathMatcher.getPathPattern()
) compared to the
actual path (as of PathMatcher.toWildcardSubstitutes(String)
).
The order of the wildcard substitutes aligns to the order of the
wildcards (from left to right) defined in your path pattern.toWildcardReplacements
in interface PathMatcher
aPath
- The path for which to retrieve the wildcard substitutes.public String toWildcardReplacementAt(String aPath, int aIndex)
PathMatcher
PathMatcher.getPathPattern()
) compared to the actual path
(as of PathMatcher.toWildcardSubstitutes(String)
). The text of
the wildcard substitute aligns to the index of the wildcard (from left to
right) as defined in your path pattern.toWildcardReplacementAt
in interface PathMatcher
aPath
- The path for which to retrieve the wildcard substitutes.aIndex
- The index of the wildcard in question for which to retrieve
the substitute.public String[] toWildcardReplacementsAt(String aPath, int... aIndexes)
PathMatcher
PathMatcher.getPathPattern()
) compared to the actual path
(as of PathMatcher.toWildcardSubstitutes(String)
). The text of
the wildcard substitutes aligns to the indexes of the wildcard (from left
to right) as defined in your path pattern.toWildcardReplacementsAt
in interface PathMatcher
aPath
- The path for which to retrieve the wildcard substitutes.aIndexes
- The indexes of the wildcards in question for which to
retrieve the substitutes.public String toWildcardReplacement(String aPath, String aWildcardName)
PathMatcher
PathMatcher.getPathPattern()
) compared to the actual path
(as of PathMatcher.toWildcardSubstitutes(String)
). The text of
the wildcard substitute aligns to the name of the wildcard (as defined in
your path pattern).toWildcardReplacement
in interface PathMatcher
aPath
- The path for which to retrieve the wildcard substitutes.aWildcardName
- The name of the wildcard in question for which to
retrieve the substitute.public String[] toWildcardReplacements(String aPath, String... aWildcardNames)
PathMatcher
PathMatcher.getPathPattern()
) compared to the actual path
(as of PathMatcher.toWildcardSubstitutes(String)
). The text of
the wildcard substitutes aligns to the order of the provided wildcard
names (as defined in your path pattern).toWildcardReplacements
in interface PathMatcher
aPath
- The path for which to retrieve the wildcard substitutes.aWildcardNames
- The names of the wildcards in question for which to
retrieve the substitutes in the order of the provided names.public String toPattern()
Copyright © 2017. All rights reserved.