Package proxytoys.examples.overview

Source Code of proxytoys.examples.overview.ProxyFactoryExample

/*
* Copyright (C) 2005 J�rg Schaible
* Created on 07-Aug-2005 by J�rg Schaible
* See license.txt for license details
*/
package proxytoys.examples.overview;

import com.thoughtworks.proxy.ProxyFactory;
import com.thoughtworks.proxy.factory.StandardProxyFactory;
import com.thoughtworks.proxy.kit.SimpleInvoker;

import java.util.ArrayList;
import java.util.List;


/**
* @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));
    }

    public static void main(String[] args) {
        System.out.println();
        System.out.println();
        System.out.println("Running ProxyFactory Examples");
        System.out.println();
        System.out.println("Example 1 of Package Overview:");
        packageOverviewExample1();
    }
}
TOP

Related Classes of proxytoys.examples.overview.ProxyFactoryExample

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.