ImplementedByMethodMetadata implementedByMethodMetadata = (ImplementedByMethodMetadata) methodMetadata;
Class<? extends ProxyMethod> proxyMethodType = implementedByMethodMetadata.getProxyMethodType();
try {
addProxyMethod(proxyMethodType.newInstance(), typeMethod.getAnnotatedElement());
} catch (InstantiationException e) {
throw new XOException("Cannot instantiate proxy method of type " + proxyMethodType.getName(), e);
} catch (IllegalAccessException e) {
throw new XOException("Unexpected exception while instantiating type " + proxyMethodType.getName(), e);
}
}
if (methodMetadata instanceof ResultOfMethodMetadata) {
ResultOfMethodMetadata resultOfMethodMetadata = (ResultOfMethodMetadata) methodMetadata;
addProxyMethod(new ResultOfMethod(sessionContext, resultOfMethodMetadata), typeMethod.getAnnotatedElement());