com.tinkerpop.frames.modules.javahandler.JavaMethodHandler Maven / Gradle / Ivy
Go to download
Windup Frames is an extension of the upstream Frames project, with tools to ease debugging and integration within windup.
package com.tinkerpop.frames.modules.javahandler;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import com.tinkerpop.blueprints.Element;
import com.tinkerpop.frames.FramedGraph;
import com.tinkerpop.frames.util.ExceptionUtils;
class JavaMethodHandler implements
com.tinkerpop.frames.modules.MethodHandler {
private JavaHandlerModule module;
JavaMethodHandler(JavaHandlerModule module) {
this.module = module;
}
@Override
public Class getAnnotationType() {
return JavaHandler.class;
}
@Override
public Object processElement(Object framedElement, Method method,
Object[] arguments, JavaHandler annotation,
FramedGraph> framedGraph, Element element) {
try {
Object handler = module.createHandler(framedElement, framedGraph, element, method.getDeclaringClass(), method);
return method.invoke(handler, arguments);
} catch (IllegalArgumentException e) {
throw new JavaHandlerException("Problem calling Java handler", e);
} catch (IllegalAccessException e) {
throw new JavaHandlerException("Problem calling Java handler", e);
} catch (InvocationTargetException e) {
ExceptionUtils.sneakyThrow(e.getTargetException());
return null;
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy