public abstract class DynamicMatcher<C> extends Object
B rewrite(A x) to
match objects of class A, and return objects of class
B. 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<?>...), C. | Modifier and Type | Field and Description |
|---|---|
protected String[] |
phaseNames |
| Modifier | Constructor and Description |
|---|---|
protected |
DynamicMatcher(String[] phaseNames) |
| Modifier and Type | Method and Description |
|---|---|
protected Method |
getMatchFor(int phase,
Class sourceClass) |
<R> R |
match(int phase,
Class<R> targetClass,
C x,
boolean total)
Finds the best-matching
rewrite method for the
dynamic type of a given object and invokes it. |
protected final String[] phaseNames
protected DynamicMatcher(String[] phaseNames)
public <R> R match(int phase,
Class<R> targetClass,
C x,
boolean total)
rewrite method for the
dynamic type of a given object and invokes it.targetClass - the expected class of the result.x - the input object.IllegalArgumentException - if the matching method throws an
exception or cannot be invoked for some reason, or if no match is
found.ClassCastException - if the result cannot be cast to the
class targetClass.NullPointerException - if x is
null.see also the complete user documentation .