Package org.neo4j.cypherdsl.core.support
Class ReflectiveVisitor
- java.lang.Object
-
- org.neo4j.cypherdsl.core.support.ReflectiveVisitor
-
- All Implemented Interfaces:
Visitor
@API(status=INTERNAL, since="1.0") public abstract class ReflectiveVisitor extends java.lang.Object implements Visitor
This is a convenience class implementing aVisitor
and it takes care of choosing the right methods to dispatch theVisitor.enter(Visitable)
andVisitor.leave(Visitable)
calls to.Classes extending this visitor need to provide corresponding
enter
andleave
methods taking exactly one argument of the type ofVisitable
they are interested it.The type must be an exact match, this support class doesn't try to find a close match up in the class hierarchy if it doesn't find an exact match.
- Since:
- 1.0
- Author:
- Michael J. Simons, Gerrit Meier
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Deque<Visitable>
currentVisitedElements
Keeps track of the ASTs current level.
-
Constructor Summary
Constructors Constructor Description ReflectiveVisitor()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
enter(Visitable visitable)
Enter aVisitable
.void
leave(Visitable visitable)
Leave aVisitable
.protected abstract void
postLeave(Visitable visitable)
This is a hook that is called with the uncasted, raw visitable just after leaving the visitable.protected abstract boolean
preEnter(Visitable visitable)
This is a hook that is called with the uncasted, raw visitable just before entering a visitable.
-
-
-
Field Detail
-
currentVisitedElements
protected java.util.Deque<Visitable> currentVisitedElements
Keeps track of the ASTs current level.
-
-
Method Detail
-
preEnter
protected abstract boolean preEnter(Visitable visitable)
This is a hook that is called with the uncasted, raw visitable just before entering a visitable.The hook is called regardless wither a matching
enter
is found or not.- Parameters:
visitable
- The visitable that is passed on to a matching enter after this call.- Returns:
- true, when visiting of elements should be stopped until this element is left again.
-
postLeave
protected abstract void postLeave(Visitable visitable)
This is a hook that is called with the uncasted, raw visitable just after leaving the visitable.The hook is called regardless wither a matching
leave
is found or not.- Parameters:
visitable
- The visitable that is passed on to a matching leave after this call.
-
enter
public final void enter(Visitable visitable)
Description copied from interface:Visitor
Enter aVisitable
.
-
-