Examples of JavassistProxyFactory


Examples of org.apache.commons.proxy.factory.javassist.JavassistProxyFactory

    }

    public void testCreateNullObject() throws Exception
    {
        final Echo nullEcho = ( Echo ) ProxyUtils
                .createNullObject( new JavassistProxyFactory(), new Class[]{ Echo.class } );
        assertNull( nullEcho.echoBack( "hello" ) );
        assertNull( nullEcho.echoBack( "hello", "world" ) );
        assertEquals( ( int ) 0, nullEcho.echoBack( 12345 ) );
    }
View Full Code Here

Examples of org.apache.commons.proxy.factory.javassist.JavassistProxyFactory

        assertEquals( ( int ) 0, nullEcho.echoBack( 12345 ) );
    }

    public void testCreateNullObjectWithClassLoader() throws Exception
    {
        final Echo nullEcho = ( Echo ) ProxyUtils.createNullObject( new JavassistProxyFactory(),
                                                                    Echo.class.getClassLoader(),
                                                                    new Class[]{ Echo.class } );
        assertNull( nullEcho.echoBack( "hello" ) );
        assertNull( nullEcho.echoBack( "hello", "world" ) );
        assertEquals( ( int ) 0, nullEcho.echoBack( 12345 ) );
View Full Code Here

Examples of org.apache.commons.proxy.factory.javassist.JavassistProxyFactory

public class TestInvocationHandlerAdapter extends TestCase
{
    public void testMethodInvocation() throws Exception
    {
        InvocationHandlerTester tester = new InvocationHandlerTester();
        final Echo echo = ( Echo ) new JavassistProxyFactory().createInvokerProxy( new InvocationHandlerAdapter( tester ), new Class[] { Echo.class } );
        echo.echoBack( "hello" );
        assertEquals( Echo.class.getMethod( "echoBack", new Class[] { String.class } ), tester.method );
        assertSame( echo, tester.proxy );
        assertNotNull( tester.arguments );
        assertEquals( 1, tester.arguments.length );
View Full Code Here

Examples of org.apache.commons.proxy.factory.javassist.JavassistProxyFactory

public class TestMethodInterceptorAdapter extends TestCase
{
    public void testMethodInterception()
    {
        final Echo proxy = ( Echo ) new JavassistProxyFactory().createInterceptorProxy( new EchoImpl(),
                                                                                         new MethodInterceptorAdapter( new SuffixMethodInterceptor(
                                                                                                 " suffix" ) ),
                                                                                         new Class[]{ Echo.class } );
        assertEquals( "message suffix", proxy.echoBack( "message" ) );
    }
View Full Code Here

Examples of org.apache.commons.proxy.factory.javassist.JavassistProxyFactory

    public void testMethodInvocationImplementation() throws Exception
    {
        final InterceptorTester tester = new InterceptorTester();
        final EchoImpl target = new EchoImpl();
        final Echo proxy = ( Echo ) new JavassistProxyFactory().createInterceptorProxy( target, new MethodInterceptorAdapter( tester ), new Class[] { Echo.class } );
        proxy.echo();
        assertNotNull( tester.invocation.getArguments() );
        assertEquals( 0, tester.invocation.getArguments().length );
        assertEquals( Echo.class.getMethod( "echo", new Class[] {} ), tester.invocation.getMethod() );
        assertEquals( Echo.class.getMethod( "echo", new Class[] {} ), tester.invocation.getStaticPart() );
View Full Code Here

Examples of org.apache.ibatis.executor.loader.javassist.JavassistProxyFactory

    return proxyFactory;
  }

  public void setProxyFactory(ProxyFactory proxyFactory) {
    if (proxyFactory == null) {
      proxyFactory = new JavassistProxyFactory();
    }
    this.proxyFactory = proxyFactory;
  }
View Full Code Here

Examples of org.apache.webbeans.proxy.JavassistProxyFactory

                logger.fine("Obtaining a delegate");
            }
            Class<?> proxyClass = webBeansContext.getJavassistProxyFactory().getInterceptorProxyClasses().get(injectionTarget);
            if (proxyClass == null)
            {
                JavassistProxyFactory proxyFactory = webBeansContext.getJavassistProxyFactory();
                ProxyFactory delegateFactory = proxyFactory.createProxyFactory(injectionTarget);
                proxyClass = proxyFactory.getProxyClass(delegateFactory);
                proxyFactory.getInterceptorProxyClasses().put(injectionTarget, proxyClass);
            }
            Object delegate = proxyClass.newInstance();
            delegateHandler = new DelegateHandler(this.contextual, ejbContext);
            ((ProxyObject)delegate).setHandler(delegateHandler);
    
View Full Code Here

Examples of org.apache.webbeans.proxy.JavassistProxyFactory

                logger.debug("Obtaining a delegate");
            }
            Class<?> proxyClass = webBeansContext.getJavassistProxyFactory().getInterceptorProxyClasses().get(injectionTarget);
            if (proxyClass == null)
            {
                JavassistProxyFactory proxyFactory = webBeansContext.getJavassistProxyFactory();
                ProxyFactory delegateFactory = proxyFactory.createProxyFactory(injectionTarget);
                proxyClass = proxyFactory.getProxyClass(delegateFactory);
                proxyFactory.getInterceptorProxyClasses().put(injectionTarget, proxyClass);
            }
            Object delegate = proxyClass.newInstance();
            delegateHandler = new DelegateHandler(this.contextual, ejbContext);
            ((ProxyObject)delegate).setHandler(delegateHandler);
    
View Full Code Here

Examples of org.apache.webbeans.proxy.JavassistProxyFactory

                logger.debug("Obtaining a delegate");
            }
            Class<?> proxyClass = webBeansContext.getJavassistProxyFactory().getInterceptorProxyClasses().get(injectionTarget);
            if (proxyClass == null)
            {
                JavassistProxyFactory proxyFactory = webBeansContext.getJavassistProxyFactory();
                ProxyFactory delegateFactory = proxyFactory.createProxyFactory(injectionTarget);
                proxyClass = proxyFactory.getProxyClass(delegateFactory);
                proxyFactory.getInterceptorProxyClasses().put(injectionTarget, proxyClass);
            }
            Object delegate = proxyClass.newInstance();
            delegateHandler = new DelegateHandler(this.contextual, ejbContext);
            ((ProxyObject)delegate).setHandler(delegateHandler);
    
View Full Code Here

Examples of org.hibernate.proxy.pojo.javassist.JavassistProxyFactory

   * Builds a Javassist-based proxy factory.
   *
   * @return a new Javassist-based proxy factory.
   */
  public ProxyFactory buildProxyFactory() {
    return new JavassistProxyFactory();
  }
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.