public final class GlobPattern extends Object
GlobPattern
defines a simplistic pattern matching. It consists
of a mandatory (leading) path and an optional "glob" that may contain one or
more wildcard characters ("*
") according to the glob matching
defined by Node.getNodes(String[])
. In contrast to that
method the GlobPattern
operates on path (not only names).
Please note the following special cases:
NodePath | Restriction | Matches ----------------------------------------------------------------------------- /foo | null | matches /foo and all children of /foo /foo | "" | matches /foo only
Examples including wildcard char:
NodePath = "/foo" Restriction | Matches ----------------------------------------------------------------------------- * | all siblings of foo and foo's and the siblings' descendants /*cat | all children of /foo whose path ends with "cat" /*/cat | all non-direct descendants of /foo named "cat" /cat* | all descendant path of /foo that have the direct foo-descendant segment starting with "cat" *cat | all siblings and descendants of foo that have a name ending with cat */cat | all descendants of /foo and foo's siblings that have a name segment "cat" cat/* | all descendants of '/foocat' /cat/* | all descendants of '/foo/cat' *cat/* | all descendants of /foo that have an intermediate segment ending with 'cat'
Modifier and Type | Method and Description |
---|---|
static GlobPattern |
create(String nodePath) |
static GlobPattern |
create(String nodePath,
String restrictions) |
boolean |
equals(Object obj) |
int |
hashCode() |
boolean |
matches(Item itemToMatch) |
boolean |
matches(String toMatch) |
String |
toString() |
public static GlobPattern create(String nodePath, String restrictions)
public static GlobPattern create(String nodePath)
public boolean matches(String toMatch)
public boolean matches(Item itemToMatch)
public int hashCode()
hashCode
in class Object
Object.hashCode()
public String toString()
toString
in class Object
Object.toString()
public boolean equals(Object obj)
equals
in class Object
Object.equals(Object)
Copyright © 2004–2021 The Apache Software Foundation. All rights reserved.