public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { Method member = methodsMap.get(method); if (member == null) { log.debug("Invoking not service class method: {} -> {}", method, method); return method.invoke(serviceClassInstance, args); } log.debug("Invoking service class method: {} -> {}", method, member); IRulesRuntimeContext context = (IRulesRuntimeContext) args[0]; Object[] methodArgs = ArrayUtils.remove(args, 0); applyRulesRuntimeContext(serviceClassInstance, context); return member.invoke(serviceClassInstance, methodArgs); }
/** * Makes invocation handler. * * @return {@link InvocationHandler} instance * @throws Exception */ protected InvocationHandler makeInvocationHandler(Object instanceObject) throws Exception { Map<Method, Method> methodsMap = makeMethodMap(getServiceClass(), getOriginalInstantiationStrategy().getInstanceClass()); return new RuntimeContextInstantiationStrategyEnhancerInvocationHandler(methodsMap, instanceObject); }
/** * Makes invocation handler. * * @return {@link InvocationHandler} instance * @throws Exception */ protected InvocationHandler makeInvocationHandler(Object instanceObject) throws Exception { Map<Method, Method> methodsMap = makeMethodMap(getServiceClass(), getOriginalInstantiationStrategy().getInstanceClass()); return new RuntimeContextInstantiationStrategyEnhancerInvocationHandler(methodsMap, instanceObject); }
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { Method member = methodsMap.get(method); if (member == null) { log.debug("Invoking not service class method: {} -> {}", method, method); return method.invoke(serviceClassInstance, args); } log.debug("Invoking service class method: {} -> {}", method, member); IRulesRuntimeContext context = (IRulesRuntimeContext) args[0]; Object[] methodArgs = ArrayUtils.remove(args, 0); applyRulesRuntimeContext(serviceClassInstance, context); return member.invoke(serviceClassInstance, methodArgs); }