public abstract class DynamicVisitor<C> extends Object
visit(C, boolean)
method with a method void visit(A x)
to match
objects of class A
. Methods of subclasses will only be
considered as matches for an input if they have public
access to be retrieved with Class.getMethod(java.lang.String, java.lang.Class<?>...)
visit
, and C
. void
do match, but their result
is ignored.Constructor and Description |
---|
DynamicVisitor() |
Modifier and Type | Method and Description |
---|---|
void |
visit(C x,
boolean total)
Finds the best-matching
visit method for the
dynamic type of a given object and invokes it. |
public void visit(C x, boolean total)
visit
method for the
dynamic type of a given object and invokes it.x
- the input object.total
- if true
and x
is
null
or no match is found, then nothing is done.IllegalArgumentException
- if the matching method throws an
exception or cannot be invoked for some reason, or if
total
is false
and no match is found.NullPointerException
- if total
is false and
x
is null
.see also the complete user documentation .