public class PredicatedResourceVisitor extends Object implements ResourceVisitor
Modifier | Constructor and Description |
---|---|
protected |
PredicatedResourceVisitor(Predicate<Resource> visitDirectory,
Predicate<Resource> applyToDirectory,
Predicate<Resource> applyToFile,
Function<Resource,Void> function) |
Modifier and Type | Method and Description |
---|---|
protected Function<Resource,Void> |
getFunction()
Can be useful to e.g.
|
static PredicatedResourceVisitor |
onAllMatchingFiles(Predicate<Resource> applyToFile,
Function<Resource,Void> function)
Traverses all directories, and applies the given
Function to all files, according to applyToFile . |
boolean |
visitDirectory(Resource resource)
Determines if we should visit this directory resource.
|
void |
visitFile(Resource resource)
Implementations can decide to do anything with the file; note that
ResourceVisitor.visitDirectory(Resource) is
NOT called for files. |
static PredicatedResourceVisitor |
with(Function<Resource,Void> function)
Visits everything and applies the given
Function to everything. |
static PredicatedResourceVisitor |
with(Predicate<Resource> visitAndApply,
Function<Resource,Void> function)
Visits according to the given
visitAndApply predicate and applies the given Function according to visitAndApply . |
static PredicatedResourceVisitor |
with(Predicate<Resource> visitDirectory,
Predicate<Resource> applyFunction,
Function<Resource,Void> function)
Visits according to the given
visitDirectory predicate and applies the given Function according to applyFunction . |
static PredicatedResourceVisitor |
with(Predicate<Resource> visitDirectory,
Predicate<Resource> applyToDirectory,
Predicate<Resource> applyToFile,
Function<Resource,Void> function)
Visits according to the given
visitDirectory predicate and applies the given Function according to applyToDirectory and applyToFile depending on the resource's type. |
public static PredicatedResourceVisitor with(Function<Resource,Void> function)
Function
to everything.public static PredicatedResourceVisitor with(Predicate<Resource> visitAndApply, Function<Resource,Void> function)
visitAndApply
predicate and applies the given Function
according to visitAndApply
.public static PredicatedResourceVisitor with(Predicate<Resource> visitDirectory, Predicate<Resource> applyFunction, Function<Resource,Void> function)
visitDirectory
predicate and applies the given Function
according to applyFunction
.public static PredicatedResourceVisitor with(Predicate<Resource> visitDirectory, Predicate<Resource> applyToDirectory, Predicate<Resource> applyToFile, Function<Resource,Void> function)
visitDirectory
predicate and applies the given Function
according to applyToDirectory
and applyToFile
depending on the resource's type.public static PredicatedResourceVisitor onAllMatchingFiles(Predicate<Resource> applyToFile, Function<Resource,Void> function)
Function
to all files, according to applyToFile
. Does not apply the function to directory resources.public boolean visitDirectory(Resource resource)
ResourceVisitor
ResourceVisitor.visitFile(Resource)
is
NOT called for directories.visitDirectory
in interface ResourceVisitor
public void visitFile(Resource resource)
ResourceVisitor
ResourceVisitor.visitDirectory(Resource)
is
NOT called for files.visitFile
in interface ResourceVisitor
Copyright © 2003–2019 Magnolia International Ltd.. All rights reserved.