Class PathPattern
java.lang.Object
org.refcodes.internal.PathPattern
The
PathPattern provides Pattern instances to be applied on
paths.
Note: This class is intended for internal use only as there is an official
PathMatcher type in the artifact refcodes-matcher
which provides official path matching functionality and where this
functionality is tested.
-
Constructor Summary
ConstructorsConstructorDescriptionPathPattern(String aPath, char aDelimiter) This constructor builds a regular expression for matching paths: The resultingPatternmatches its ANT like path pattern against the path provided. -
Method Summary
-
Constructor Details
-
PathPattern
This constructor builds a regular expression for matching paths: The resultingPatternmatches its ANT like path pattern against the path provided. ThePatternimplements the following rules from the ANT path pattern to the path provided: 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. The single asterisk ("*"), the double asterisk ("**") and the question mark ("?") we refer to as wildcards: You may name a wildcard by prefixing it with "${someWildcardName}=". For example a named wildcard may look as follows: "${arg1}=*" or "${arg2}=**" or "${arg3}=?". A placeholder "${arg1}" with no wildcard assignment "=" is equivalent to "${arg1}=*".The regular expression pattern construction is inspired by: "http://stackoverflow.com/questions/33171025/regex-matching-an-ant-path"
Note: This class is the internal implementation of the
PathMatchertype in the artifactrefcodes-matcher!- Parameters:
aPath- the pathaDelimiter- The delimiter separating the path elements from each other and must not be one of the following chars: '?', '*', '|'.- Throws:
IllegalArgumentException- thrown in case the delimiter provided was one of the following chars: '?', '*', '|'.
-
-
Method Details
-
getPattern
-
getWildcardNames
Returns an array of the detected wildcard names.- Returns:
- The according wildcard names or null if there were no named wildcards
-