use of org.platformlayer.ops.reflection.MethodInvoker in project platformlayer by platformlayer.
the class OperationInvoker method invoke.
public void invoke(Object controller) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException {
final BindingScope scope = BindingScope.get();
Method method = findTargetMethod(controller, scope);
if (method == null) {
throw new IllegalStateException("Cannot find handler for operation on " + controller.getClass());
}
MethodInvoker invoker = invokerProvider.get();
if (scope != null) {
invoker.addProvider(new Function<Class<?>, Object>() {
@Override
public Object apply(Class<?> clazz) {
return scope.getInstance(clazz);
}
});
}
invoker.invokeMethod(controller, method);
}
Aggregations