org.jboss.forge.shell.util
Class PathspecParser
java.lang.Object
org.jboss.forge.shell.util.PathspecParser
public class PathspecParser
- extends Object
Parser of UNIX-style pathspec. The parser accepts a resource, and provides a result set of resources based on the
relative path provided.
Example:
List> res = new PathspecParser(factoryInstance, relativeResource, "../../foobar");
Where factoryInstance is an instance of ResourceFactory
, relativeResource is a resource,
such as a file or directory, for which the relative result for ../../foobar will be calculated.
Wildcards * and ? are accepted.
- Author:
- Mike Brock
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
PathspecParser
public PathspecParser(ResourceFactory factory,
Resource<?> res,
String path)
resolve
public List<Resource<?>> resolve()
- Resolve the results.
- Returns:
- A list of resources that match the path. Empty if there are no matches.
search
public List<Resource<?>> search()
- Perform a search, by doing a breadth-first traversal of the resource tree for resources that match the path
string.
- Returns:
- A list of resources that match the path string. Empty if there are no matches.
pathspecToRegEx
public static String pathspecToRegEx(String pathSpec)
Copyright © 2012 JBoss, a division of Red Hat, Inc.. All Rights Reserved.