Package java.lang.reflect

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


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


      Class<SimpleInterface> businessInterface = null;
      InvocationHandler handler = new EndpointInvocationHandler(endpoint, session, businessInterface);
      Object proxy = null;
      Method method = Object.class.getDeclaredMethod("hashCode");
      Object args[] = null;
      int result = (Integer) handler.invoke(proxy, method, args);
      assertEquals(createHashCode(endpoint, session, businessInterface), result);
   }

   @Test
   public void testHashCodeWithBusinessInterface() throws Exception
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

        for( MockResolver mockResolver : mockRepository.getAll() )
        {
            InvocationHandler handler = mockResolver.getInvocationHandler( proxy, method, args );
            if( handler != null )
            {
                return handler.invoke( mockResolver, method, args );
            }
        }
        throw new IllegalStateException( "There is no mock registered that can handle " + method );
    }
}
View Full Code Here

        throws Throwable
    {
        try
        {
            InvocationHandler invocationHandler = Proxy.getInvocationHandler( this.proxy );
            return invocationHandler.invoke( this.proxy, method, args );
        }
        catch( InvocationTargetException e )
        {
            throw e.getTargetException();
        }
View Full Code Here

        throws Throwable
    {
        try
        {
            InvocationHandler invocationHandler = Proxy.getInvocationHandler( this.proxy );
            return invocationHandler.invoke( this.proxy, method, args );
        }
        catch( InvocationTargetException e )
        {
            throw e.getTargetException();
        }
View Full Code Here

        throws Throwable
    {
        if( delegate instanceof InvocationHandler )
        {
            InvocationHandler handler = (InvocationHandler) delegate;
            return handler.invoke( object, method, args );
        }
        else
        {
            try
            {
View Full Code Here

    @Override
    public Object invoke( Object composite, Method method, Object[] args ) throws Throwable
    {
        InvocationHandler handler = methods.get( compositeType ).get( method );

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

    public static class TraitFilter
        implements AppliesToFilter
    {
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);
            }
        });
    }
   
    synchronized private InvocationHandler getJBIInvocationHandler() throws Exception {
View Full Code Here

            } 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

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.