public abstract class VirtualFileVisitor<T>
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
VirtualFileVisitor.Option |
static class |
VirtualFileVisitor.Result |
protected static class |
VirtualFileVisitor.VisitorException |
Modifier and Type | Field and Description |
---|---|
static VirtualFileVisitor.Result |
CONTINUE |
static VirtualFileVisitor.Option |
NO_FOLLOW_SYMLINKS |
static VirtualFileVisitor.Option |
ONE_LEVEL_DEEP |
static VirtualFileVisitor.Result |
SKIP_CHILDREN |
static VirtualFileVisitor.Option |
SKIP_ROOT |
Modifier | Constructor and Description |
---|---|
protected |
VirtualFileVisitor(VirtualFileVisitor.Option... options) |
Modifier and Type | Method and Description |
---|---|
void |
afterChildrenVisited(VirtualFile file)
This method is only called if visiting wasn't interrupted (by returning skip-requesting result
from visitFile(VirtualFile) or visitFileEx(VirtualFile) methods).
|
java.lang.Iterable<VirtualFile> |
getChildrenIterable(VirtualFile file)
By default, visitor uses (VirtualFile.getChildren()) to iterate over file's children.
|
T |
getCurrentValue() |
static VirtualFileVisitor.Option |
limit(int maxDepth) |
void |
setValueForChildren(T value)
Stores the
value to this visitor. |
static VirtualFileVisitor.Result |
skipTo(VirtualFile parentToSkipTo) |
boolean |
visitFile(VirtualFile file)
Simple visiting method.
|
VirtualFileVisitor.Result |
visitFileEx(VirtualFile file)
Extended visiting method.
|
public static final VirtualFileVisitor.Option NO_FOLLOW_SYMLINKS
public static final VirtualFileVisitor.Option SKIP_ROOT
public static final VirtualFileVisitor.Option ONE_LEVEL_DEEP
public static final VirtualFileVisitor.Result CONTINUE
public static final VirtualFileVisitor.Result SKIP_CHILDREN
protected VirtualFileVisitor(VirtualFileVisitor.Option... options)
public static VirtualFileVisitor.Option limit(int maxDepth)
public static VirtualFileVisitor.Result skipTo(VirtualFile parentToSkipTo)
public boolean visitFile(VirtualFile file)
true
a visitor will proceed to file's children, on false
- to file's next sibling.file
- a file to visit.true
to proceed to file's children, false
to skip to file's next sibling.public VirtualFileVisitor.Result visitFileEx(VirtualFile file)
file
- a file to visit.public void afterChildrenVisited(VirtualFile file)
file
- a file whose children were successfully visited.public java.lang.Iterable<VirtualFile> getChildrenIterable(VirtualFile file)
file
- a virtual file to get children from.public final void setValueForChildren(T value)
value
to this visitor. The stored value can be retrieved later by calling the getCurrentValue()
.
The visitor maintains the stack of stored values. I.e:
This value is held here only during the visiting the current file and all its children. As soon as the visitor finished with
the current file and all its subtree and returns to the level up, the value is cleared
and the getCurrentValue()
returns the previous value, which was stored here before this method call.public final T getCurrentValue()