|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.vleu.visitomatic.VisitorRunner
public abstract class VisitorRunner
Allows to run a Visitor
on a Visitable
.
More specifically, when its
ReflectionBasedVisitorRunner.visit(Visitor, Visitable)
method
is called, it will analyze the provided Visitable
, extract the
fields annotated by ToVisit
and use them as argument to call a
method annotated by VisitingMethod
from the Visitor
The expected usage is that there will be a private static final instance
of ReflectionBasedVisitorRunner per Visitor
class, ready to be called
on instances when needed.
Visitor
,
Visitable
Nested Class Summary | |
---|---|
class |
VisitorRunner.VisitorRunnerException
Represents an error that occurred during the operation of a VisitorRunner . |
class |
VisitorRunner.VisitorRunnerInitialisationException
Represents an error that occurred during the static analysis of a Visitor . |
Constructor Summary | |
---|---|
protected |
VisitorRunner()
Call getInstance(java.lang.Class extends net.vleu.visitomatic.Visitor>, java.lang.String) to get an instance. |
Method Summary | ||
---|---|---|
abstract
|
futureVisit(Visitor visitor,
Visitable visitable)
Return a FutureTask that analyzes the provided Visitable ,
extracts the fields annotated by ToVisit and uses them as argument
to call a method annotated by VisitingMethod from the
Visitor |
|
static VisitorRunner |
getInstance(java.lang.Class<? extends Visitor> visitorClass,
java.lang.String visitName)
Analyzes a Visitor Class and and returns a VisitorRunner
ready to run on one or more Visitor of this class on one ore more
Visitable s. |
|
abstract
|
visit(Visitor visitor,
Visitable visitable)
Analyzes the provided Visitable , extracts the
fields annotated by ToVisit and uses them as argument to call a
method annotated by VisitingMethod from the Visitor |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected VisitorRunner()
getInstance(java.lang.Class extends net.vleu.visitomatic.Visitor>, java.lang.String)
to get an instance.
Method Detail |
---|
public static final VisitorRunner getInstance(java.lang.Class<? extends Visitor> visitorClass, java.lang.String visitName) throws VisitorRunner.VisitorRunnerInitialisationException
Visitor
Class and and returns a VisitorRunner
ready to run on one or more Visitor
of this class on one ore more
Visitable
s.
visitorClass
- The class of the Visitor
s the VisitorRunner
we will runvisitName
- The name of the visit, as given to VisitingMethod
s in the Visitor
VisitorRunner
for Visitor
s and Visitable
s of those classes
VisitorRunner.VisitorRunnerInitialisationException
- If we failed to analyze the visitorVisitor
,
VisitingMethod
public abstract <R> R visit(Visitor visitor, Visitable visitable) throws VisitorRunner.VisitorRunnerException
Visitable
, extracts the
fields annotated by ToVisit
and uses them as argument to call a
method annotated by VisitingMethod
from the Visitor
R
- The return typevisitor
- The visitor to runvisitable
- The visitable to visit
VisitorRunner.VisitorRunnerException
- An error occurs during the running of the visitorToVisit
,
VisitingMethod
public abstract <R> java.util.concurrent.FutureTask<R> futureVisit(Visitor visitor, Visitable visitable)
FutureTask
that analyzes the provided Visitable
,
extracts the fields annotated by ToVisit
and uses them as argument
to call a method annotated by VisitingMethod
from the
Visitor
R
- The return typevisitor
- The visitor to runvisitable
- The visitable to visit
ToVisit
,
VisitingMethod
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |