Package java.lang.reflect

Examples of java.lang.reflect.InvocationHandler.invoke()


            } catch (Exception e) {
                throw new ServiceRuntimeException(e);
            }

            InvocationHandler handler = Proxy.getInvocationHandler(proxyFactory.createProxy(serviceInterface, epr));
            return handler.invoke(proxy, method, args);
           
        } finally {
            nodeFactory.destroy();
        }
    }
View Full Code Here


            }
        }

        // handler should never be null here.

        return handler.invoke( proxy, method, args ) ;
    }

    private static final DynamicAccessPermission perm = new DynamicAccessPermission("access");
    private void checkAccess() {
        final SecurityManager sm = System.getSecurityManager();
View Full Code Here

      }
  }

  // handler should never be null here.

  return handler.invoke( proxy, method, args ) ;
    }
}
View Full Code Here

    private Object createProxy() throws Exception {
       
        return Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), new Class[]{type}, new InvocationHandler(){
            public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
                InvocationHandler next = getJBIInvocationHandler();
                return next.invoke(proxy, method, args);
            }
        });
       
    }
   
View Full Code Here

        Object output;
        try {
            EntryPointContext entryPointContext = (EntryPointContext) ((ScaServiceUnit) serviceUnit)
                    .getTuscanyRuntime().getModuleContext().getContext(entryPoint.getName());
            InvocationHandler handler = (InvocationHandler) entryPointContext.getImplementationInstance();
            output = handler.invoke(null, method, new Object[] { input });
        } catch (UndeclaredThrowableException e) {
            throw e;
        } catch (RuntimeException e) {
            throw e;
        } catch (Error e) {
View Full Code Here

                    return null;
                }
            } else {
                InvocationHandler handler = Proxy.getInvocationHandler(instance);
                try {
                    return handler.invoke(instance, method, args);
                } catch (Throwable e) {
                    wrapException(method, e);
                    return null;
                }
            }
View Full Code Here

    return new Call<T,R>() {
        public R call(T instance) throws IOException {
          try {
            if (Proxy.isProxyClass(instance.getClass())) {
              InvocationHandler invoker = Proxy.getInvocationHandler(instance);
              return (R)invoker.invoke(instance, method, args);
            } else {
              LOG.warn("Non proxied invocation of method '"+method.getName()+"'!");
              return (R)method.invoke(instance, args);
            }
          }
View Full Code Here

          final Class<?> declaringClass= method.getDeclaringClass();
          return constructor.newInstance(declaringClass, MethodHandles.Lookup.PRIVATE).unreflectSpecial(method, declaringClass).bindTo(proxy).invokeWithArguments(args);
        }
      };

      return handler.invoke(proxy, method, args);
    }
  }

  public static Object create(String className, String invokeName, String returnType, String invokeType, String handle2, Object objects, String callType)
  {
View Full Code Here

            }
        }

        // handler should never be null here.

        return handler.invoke( proxy, method, args ) ;
    }
}
View Full Code Here

      Object proxy = null;
      // just make sure method is not null
      Method method = SessionTestCase.class.getDeclaredMethod("testSession");
      Date now = new Date();
      Object args[] = { now };
      Object result = handler.invoke(proxy, method, args);
      assertEquals("Hi " + now, result);
   }
}
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.