|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.entityfs.support.filter.AbstractConvenientFilter<EntityView>
org.entityfs.util.filter.regexp.EntityLocationGlobFilter
public class EntityLocationGlobFilter
This is a filter that matches an entity's location relative to a base
directory against a glob pattern, for instance doc\/*\/*.xml.
This can be used together with EntityNameGlobFilter:s to construct
filters matching specific files in a file hierarchy. (Compare this with
Apache Ant's include and exclude patterns.) The example below shows an
iterator that will return all XML files in all doc catalogs in all
non-test projects in an Eclipse workspace.
\/\/ wosRoot is a Directory for the workspace's root directory. This filter is not very
suitable for using as a selection filter in a recursive iterator. It is
easier to use it for filtering the results from a recursive iterator in a
Iterator
Directories.getDepthLastIterator(
wosRoot,
new EntityNameGlobFilter("*_test").and(
new EntityParentFilter(wosRoot)).not()),
new EntityLocationGlobFilter(wosRoot,"*\/doc").and(
new EFileNameExtensionFilter("xml"));
FilteringIterator instead.
EntityNameGlobFilter| Constructor Summary | |
|---|---|
EntityLocationGlobFilter(DirectoryView baseDir,
String pattern)
Create a location glob filter that will compare locations relative to the given base directory. |
|
EntityLocationGlobFilter(DirectoryView baseDir,
String pattern,
boolean caseSensitive)
Create a location glob filter that will compare locations relative to the given base directory. |
|
| Method Summary | |
|---|---|
boolean |
equals(Object o)
|
int |
hashCode()
|
boolean |
matches(EntityView ev)
Does the filter match the object? |
String |
toString()
|
| Methods inherited from class org.entityfs.support.filter.AbstractConvenientFilter |
|---|
and, bitwiseNegate, isCase, not, or, xor |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public EntityLocationGlobFilter(DirectoryView baseDir,
String pattern)
throws PatternSyntaxException
baseDir - The base directorypattern - The glob pattern. Patterns for the different path segments
are separated with slashes. See the example above.
PatternSyntaxException - On syntax errors in the glob patterns.
public EntityLocationGlobFilter(DirectoryView baseDir,
String pattern,
boolean caseSensitive)
throws PatternSyntaxException
baseDir - The base directorypattern - The glob pattern. Patterns for the different path segments
are separated with slashes. See the example above.caseSensitive - Will the filter be case sensitive?
PatternSyntaxException - On syntax errors in the glob patterns.| Method Detail |
|---|
public boolean matches(EntityView ev)
Filter
matches in interface Filter<EntityView>ev - The object to match.
true if the filter matches the object.public boolean equals(Object o)
equals in class Objectpublic int hashCode()
hashCode in class Objectpublic String toString()
toString in class Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||