Package magnet
Interface Visitor
-
public interface Visitor
Implementation of this interface should be used withScope.accept(Visitor, int)
for iterating though instances and subscopes of a scope. Scope visiting begins with iterating through all instances and then through all subscopes.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
Visitor.Instance
Visited instance.static class
Visitor.Provision
Provision type.static interface
Visitor.Scope
Visited scope.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
onEnterScope(@NotNull Visitor.Scope scope, @Nullable Visitor.Scope parent)
Called when new scope is entered.void
onExitScope(@NotNull Visitor.Scope scope)
Called when previously entered scope is exited.boolean
onInstance(@NotNull Visitor.Instance instance)
Called when visiting new instance betweenonEnterScope(Scope, Scope)
andonExitScope(Scope)
calls.
-
-
-
Method Detail
-
onEnterScope
boolean onEnterScope(@NotNull @NotNull Visitor.Scope scope, @Nullable @Nullable Visitor.Scope parent)
Called when new scope is entered.- Parameters:
scope
- entered scope.parent
- parent scope of the entered scope.- Returns:
true
to visit instances of this scope,false
to skip instances.
-
onInstance
boolean onInstance(@NotNull @NotNull Visitor.Instance instance)
Called when visiting new instance betweenonEnterScope(Scope, Scope)
andonExitScope(Scope)
calls.- Parameters:
instance
- visited instance.- Returns:
true
to visit the next instance in the scope orfalse
to skip all other instances in this scope.
-
onExitScope
void onExitScope(@NotNull @NotNull Visitor.Scope scope)
Called when previously entered scope is exited.- Parameters:
scope
- exited scope.
-
-