public boolean matches()

in src/main/java/org/apache/sling/oak/restrictions/impl/ResourceTypePattern.java [91:110]


    public boolean matches(@NotNull Tree tree, @Nullable PropertyState property) {
        boolean isMatch = matchesAtTree(tree);
        if(!isMatch && matchChildren) { // try parent hierarchy
            Tree treeCursor = tree;
            while(!isMatch && !treeCursor.isRoot()) {
                treeCursor = treeCursor.getParent();
                if(!treeCursor.getPath().startsWith(limitedToPath)) {
                    if(LOG.isTraceEnabled()) {
                        LOG.trace("Breaking parent traversal loop: tree={}, limitedToPath={}", treeCursor.getPath(), limitedToPath);
                    }
                    break; 
                }
                isMatch = matchesAtTree(treeCursor);
            }
        }
        if(LOG.isDebugEnabled()) {
            LOG.debug("Match for "+tree.getPath()+": "+ (isMatch ? "YES":"NO") + " ("+this+")");
        }
        return isMatch;
    }