public class PredicatedResourceVisitor extends Object implements ResourceVisitor
Modifier | Constructor and Description |
---|---|
protected |
PredicatedResourceVisitor(com.google.common.base.Predicate<Resource> visitDirectory,
com.google.common.base.Predicate<Resource> applyToDirectory,
com.google.common.base.Predicate<Resource> applyToFile,
com.google.common.base.Function<Resource,Void> function) |
Modifier and Type | Method and Description |
---|---|
protected com.google.common.base.Function<Resource,Void> |
getFunction()
Can be useful to e.g.
|
static PredicatedResourceVisitor |
onAllMatchingFiles(com.google.common.base.Predicate<Resource> applyToFile,
com.google.common.base.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(com.google.common.base.Function<Resource,Void> function)
Visits everything and applies the given
Function to everything. |
static PredicatedResourceVisitor |
with(com.google.common.base.Predicate<Resource> visitAndApply,
com.google.common.base.Function<Resource,Void> function)
Visits according to the given
visitAndApply predicate and applies the given Function according to visitAndApply . |
static PredicatedResourceVisitor |
with(com.google.common.base.Predicate<Resource> visitDirectory,
com.google.common.base.Predicate<Resource> applyFunction,
com.google.common.base.Function<Resource,Void> function)
Visits according to the given
visitDirectory predicate and applies the given Function according to applyFunction . |
static PredicatedResourceVisitor |
with(com.google.common.base.Predicate<Resource> visitDirectory,
com.google.common.base.Predicate<Resource> applyToDirectory,
com.google.common.base.Predicate<Resource> applyToFile,
com.google.common.base.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(com.google.common.base.Function<Resource,Void> function)
Function
to everything.public static PredicatedResourceVisitor with(com.google.common.base.Predicate<Resource> visitAndApply, com.google.common.base.Function<Resource,Void> function)
visitAndApply
predicate and applies the given Function
according to visitAndApply
.public static PredicatedResourceVisitor with(com.google.common.base.Predicate<Resource> visitDirectory, com.google.common.base.Predicate<Resource> applyFunction, com.google.common.base.Function<Resource,Void> function)
visitDirectory
predicate and applies the given Function
according to applyFunction
.public static PredicatedResourceVisitor with(com.google.common.base.Predicate<Resource> visitDirectory, com.google.common.base.Predicate<Resource> applyToDirectory, com.google.common.base.Predicate<Resource> applyToFile, com.google.common.base.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(com.google.common.base.Predicate<Resource> applyToFile, com.google.common.base.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–2017 Magnolia International Ltd.. All rights reserved.