public final class PathMatcher extends Object
A path matcher can be given an optional list of include patterns, and an optional list of exclude patterns. A given file path matches the pattern if it is matched by at least one include pattern (or there is a null includes list), and is not matched by any of the exclude patterns (if this list is not null).
The format is based on Ant patterns. Some details:
Some example patterns:
|Constructor and Description|
Create a path matching object.
|Modifier and Type||Method and Description|
Find folders which match although their parent folders do not; or folders which do not match but which contain files which do.
Check whether a given path matches some includes (if not null) and no excludes.
matches(java.lang.String, boolean)multiple times than to recreate a matcher for each query.
includes- a list of paths to match, or null to match everything by default
excludes- a list of paths to not match, or null
base- a base directory to scan for known include roots (see
findIncludedRoots()), or null if unknown
public boolean matches(String path, boolean useKnownIncludes)
path- a relative file path as described in class Javadoc
useKnownIncludes- true to also match in case this path is a parent of some known included root
public Set<File> findIncludedRoots() throws IllegalArgumentException
matchare noted, and their minimal paths are returned.
Built on May 15 2022. | Copyright © 2017-2022 Apache Software Foundation. All Rights Reserved.