001/*
002 * (c) 2005, 2009, 2010 ThoughtWorks Ltd
003 * All rights reserved.
004 *
005 * The software in this package is published under the terms of the BSD
006 * style license a copy of which has been included with this distribution in
007 * the LICENSE.txt file.
008 * 
009 * Created on 07-Aug-2005
010 */
011package proxytoys.examples.overview;
012
013import java.util.ArrayList;
014import java.util.List;
015
016import com.thoughtworks.proxy.ProxyFactory;
017import com.thoughtworks.proxy.factory.StandardProxyFactory;
018import com.thoughtworks.proxy.kit.SimpleInvoker;
019
020
021/**
022 * @author Jörg Schaible
023 */
024public class ProxyFactoryExample {
025
026    public static void packageOverviewExample1() {
027        ProxyFactory factory = new StandardProxyFactory();
028        List<String> proxy = factory.createProxy(new SimpleInvoker(new ArrayList<String>()), List.class);
029        proxy.add("Hello World");
030        System.out.println("Size of list: " + proxy.size());
031        System.out.println("First element of list: " + proxy.get(0));
032    }
033
034    public static void main(String[] args) {
035        System.out.println();
036        System.out.println();
037        System.out.println("Running ProxyFactory Examples");
038        System.out.println();
039        System.out.println("Example 1 of Package Overview:");
040        packageOverviewExample1();
041    }
042}