public class ConditionTransformAnalyzer extends java.lang.Object implements Analyzer
Modifier and Type | Field and Description |
---|---|
protected @NotNull java.util.function.BiPredicate<Compilation,Tree> |
condition
The testing predicate.
|
protected @NotNull java.lang.String |
target
The targeted kind.
|
protected @NotNull java.lang.String |
transform
The new kind.
|
Constructor and Description |
---|
ConditionTransformAnalyzer(@NotNull java.lang.String target,
@NotNull java.lang.String transform,
@NotNull java.util.function.BiPredicate<Compilation,Tree> condition)
Construct a new analyzer that transforms the trees with kind equals to the given
target kind into the given transform kind if the given condition function returned true for those trees. |
Modifier and Type | Method and Description |
---|---|
boolean |
analyze(@NotNull Compilation compilation,
@NotNull Tree tree)
Analyze the given
tree and its relative trees. |
@NotNull protected final @NotNull java.util.function.BiPredicate<Compilation,Tree> condition
@NotNull protected final @NotNull java.lang.String target
@NotNull protected final @NotNull java.lang.String transform
public ConditionTransformAnalyzer(@NotNull @NotNull java.lang.String target, @NotNull @NotNull java.lang.String transform, @NotNull @NotNull java.util.function.BiPredicate<Compilation,Tree> condition)
target
kind into the given transform
kind if the given condition
function returned true for those trees.target
- the targeted kind.transform
- the new kind.condition
- the condition function.java.lang.NullPointerException
- if the given target
or transform
or
condition
is null.public boolean analyze(@NotNull @NotNull Compilation compilation, @NotNull @NotNull Tree tree)
Analyzer
tree
and its relative trees.