Class Pattern
java.lang.Object
org.apache.jackrabbit.spi.commons.name.Pattern
Pattern to match normalized
Paths.
A pattern matches either a constant path, a name of a path element, a selection of
either of two patterns or a sequence of two patterns. The matching process is greedy.
That is, whenever a match is not unique only the longest match is considered.
Matching consumes as many elements from the beginning of an input path as possible and
returns what's left as an instance of MatchResult.
Use the Matcher class for matching a whole path or finding matches inside a path.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Patternall()A pattern which matches all input.Matches this pattern against the input.static PatternConstructs a pattern which matches a path elements against regular expressions.static PatternConstruct a new pattern which matches a path element of a given namestatic Patternnothing()A pattern which matches nothing.static PatternConstruct a new pattern which matches an exact pathstatic PatternA pattern which matchespatternas many times as possiblestatic PatternA pattern which matchespatternas many times as possible but at leastmintimes and at mostmaxtimes.static PatternA pattern which matchespattern1followed bypattern2and returns the longer of the two matches.static PatternA pattern which matchespattern1followed bypattern2.
-
Constructor Details
-
Pattern
public Pattern()
-
-
Method Details
-
match
Matches this pattern against the input.- Parameters:
input- path to match with this pattern- Returns:
- result from the matching
patternagainstinput - Throws:
IllegalArgumentException- ifinputis not normalized
-
path
Construct a new pattern which matches an exact path- Parameters:
path-- Returns:
- A pattern which matches
pathand nothing else - Throws:
IllegalArgumentException- ifpathisnull
-
name
Construct a new pattern which matches a path element of a given name- Parameters:
name-- Returns:
- A pattern which matches a path element with name
name - Throws:
IllegalArgumentException- ifnameisnull
-
name
Constructs a pattern which matches a path elements against regular expressions.- Parameters:
namespaceUri- A regular expression used for matching the name space URI of a path element.localName- A regular expression used for matching the local name of a path element- Returns:
- A pattern which matches a path element if namespaceUri matches the name space URI of the path element and localName matches the local name of the path element.
- Throws:
IllegalArgumentException- if eithernamespaceUriorlocalNameisnull- See Also:
-
all
A pattern which matches all input.- Returns:
-
nothing
A pattern which matches nothing.- Returns:
-
selection
A pattern which matchespattern1followed bypattern2and returns the longer of the two matches.- Parameters:
pattern1-pattern2-- Returns:
- Throws:
IllegalArgumentException- if either argument isnull
-
sequence
A pattern which matchespattern1followed bypattern2.- Parameters:
pattern1-pattern2-- Returns:
-
repeat
A pattern which matchespatternas many times as possible- Parameters:
pattern-- Returns:
-
repeat
A pattern which matchespatternas many times as possible but at leastmintimes and at mostmaxtimes.- Parameters:
pattern-min-max-- Returns:
-