public final class ItemNameMatcher
extends java.lang.Object
javax.jcr.Node#getNodes(String)
,
javax.jcr.Node#getNodes(String[])
, javax.jcr.Node#getProperties(String)
and javax.jcr.Node#getProperties(String[])
.Modifier and Type | Method and Description |
---|---|
static boolean |
matches(java.lang.String name,
java.lang.String pattern)
Matches the name pattern against the specified name.
|
static boolean |
matches(java.lang.String name,
java.lang.String[] nameGlobs)
Matches the
nameGlob strings in the passed array against
the specified name. |
public static boolean matches(java.lang.String name, java.lang.String pattern)
The pattern may be a full name or a partial name with one or more wildcard characters ("*"), or a disjunction (using the "|" character to represent logical OR) of these. For example,
"jcr:*|foo:bar"
would match
"foo:bar"
, but also "jcr:whatever"
.
The EBNF for pattern is: namePattern ::= disjunct {'|' disjunct} disjunct ::= name [':' name] name ::= '*' | ['*'] fragment {'*' fragment}['*'] fragment ::= char {char} char ::= nonspace | ' ' nonspace ::= (* Any Unicode character except: '/', ':', '[', ']', '*', ''', '"', '|' or any whitespace character *)Note that leading and trailing whitespace around a pattern is ignored.
name
- the name to test the pattern withpattern
- the pattern to be matched against the namejavax.jcr.Node#getNodes(String)
public static boolean matches(java.lang.String name, java.lang.String[] nameGlobs)
nameGlob
strings in the passed array against
the specified name.
A glob may be a full name or a partial name with one or more
wildcard characters ("*
").
Note that unlike in the case of the matches(String, String)
leading and trailing whitespace around a glob is not ignored.
name
- the name to test the pattern withnameGlobs
- an array of globbing stringsjavax.jcr.Node#getNodes(String[])
"Copyright © 2010 - 2020 Adobe Systems Incorporated. All Rights Reserved"