Package com.thoughtworks.proxy

Examples of com.thoughtworks.proxy.ProxyFactory


        pico.registerComponentImplementation(DefaultPicoContainerLifecycleTestCase.Four.class);
        pico.registerComponentImplementation(DefaultPicoContainerLifecycleTestCase.Two.class);
        pico.registerComponentImplementation(DefaultPicoContainerLifecycleTestCase.One.class);
        pico.registerComponentImplementation(DefaultPicoContainerLifecycleTestCase.Three.class);

        ProxyFactory proxyFactory = new StandardProxyFactory();
        Startable startable = (Startable) Multicaster.object(pico, true, proxyFactory);
        Startable stoppable = (Startable) Multicaster.object(pico, false, proxyFactory);
        Disposable disposable = (Disposable) Multicaster.object(pico, false, proxyFactory);

        startable.start();
View Full Code Here


* @author Jörg Schaible
*/
public class CglibProxyFactoryTest extends TestCase {

    public void testShouldDenyProxyGenerationForFinalClasses() throws Exception {
        ProxyFactory factory = new CglibProxyFactory();
        assertFalse(factory.canProxy(String.class));
    }
View Full Code Here

        assertEquals("world", map.get("hello"));
    }

    public void testShouldNotReturnProxyWhenThereIsOnlyOneForUndeclaredReturnType() {
        Map map = new HashMap();
        ProxyFactory factory = getFactory();
        Object multicast = Multicasting.object(factory, new Object[]{map});
        assertFalse(factory.isProxyClass(multicast.getClass()));
        assertSame(map, multicast);
    }
View Full Code Here

        assertSame(map, multicast);
    }

    public void testShouldNotReturnProxyWhenThereIsOnlyOneForCompatibleDeclaredReturnTypes() {
        Map map = new HashMap();
        ProxyFactory factory = getFactory();
        Object multicast = Multicasting.object(new Class[]{Map.class, Serializable.class}, factory, new Object[]{map});
        assertFalse(factory.isProxyClass(multicast.getClass()));
        assertSame(map, multicast);
    }
View Full Code Here

*/
public class NullToyExample {

    public static void packageOverviewExample1() {
        try {
            ProxyFactory factory = new CglibProxyFactory();
            File file = (File)Null.object(File.class, factory);
            System.out.println("Length is: " + file.length());
            System.out.println("Exists: " + file.exists());
            System.out.println("Array is empty: " + file.list().length);
            System.out.println("toURL returns null, since URL is final: " + (file.toURL() == null));
View Full Code Here

* @author Jörg Schaible
*/
public class ProxyFactoryExample {

    public static void packageOverviewExample1() {
        ProxyFactory factory = new StandardProxyFactory();
        List proxy = (List)factory.createProxy(new Class[]{List.class}, new SimpleInvoker(new ArrayList()));
        proxy.add("Hello World");
        System.out.println("Size of list: " + proxy.size());
        System.out.println("First element of list: " + proxy.get(0));
    }
View Full Code Here

TOP

Related Classes of com.thoughtworks.proxy.ProxyFactory

Copyright © 2018 www.massapicom. 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.