public CtMethod<?> getCallback(SymbolicInstance<?> instance,
Class<?> clazz, String methodName) {
CtTypeReference<?> type = instance.getConcreteType();
CtMethod<?> method = null;
if (clazz.isAssignableFrom(type.getActualClass())) {
Factory factory = type.getFactory();
CtSimpleType<?> simpleType = factory.Type().getFactory().Class()
.create(type.getQualifiedName());
method = ((CtType<?>) simpleType).getMethod(methodName, factory
.Type().createReference(clazz));
}
return method;
}