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