Class GlobPattern

  • 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'