Example usage for org.apache.commons.vfs2 FileName isDescendent

List of usage examples for org.apache.commons.vfs2 FileName isDescendent

Introduction

In this page you can find the example usage for org.apache.commons.vfs2 FileName isDescendent.

Prototype

boolean isDescendent(FileName descendent);

Source Link

Document

Determines if another file name is a descendent of this file name.

Usage

From source file:org.metaborg.intellij.jps.projects.JpsProjectService.java

/**
 * Determines whether the specified file is equal to or a descendant of the specified path.
 *
 * @param ancestor   The path./*w  w  w  .  ja v a2 s .  co  m*/
 * @param descendant The descendant.
 * @return <code>true</code> when the file is equal to or a descendant of the path;
 * otherwise, <code>false</code>.
 */
private boolean isEqualOrDescendant(final String ancestor, final FileObject descendant) {
    final FileObject contentRoot = this.resourceService.resolve(ancestor);
    final FileName lhs = contentRoot.getName();
    final FileName rhs = descendant.getName();
    return lhs.equals(rhs) || lhs.isDescendent(rhs);
}