Examples of InvocationDecoratorSupport


Examples of com.thoughtworks.proxy.toys.decorate.InvocationDecoratorSupport

public class DecorateToyExample {

    public static void packageOverviewExample1() {
        List list = Arrays.asList(new String[]{"1", "2", "3"});
        Iterator intIter = (Iterator)Decorating.object(
                Iterator.class, list.iterator(), new InvocationDecoratorSupport() {
                    public Object decorateResult(Object proxy, Method method, Object[] args, Object result) {
                        if (method.getName().equals("next"))
                            return Integer.valueOf((String)result);
                        else
                            return result;
View Full Code Here

Examples of com.thoughtworks.proxy.toys.decorate.InvocationDecoratorSupport

        }
    }

    public static void packageOverviewExample2() {
        File file = new File(".");
        File decoratedFile = (File)Decorating.object(new Class[]{File.class}, file, new InvocationDecoratorSupport() {
            public Object[] beforeMethodStarts(Object proxy, Method method, Object[] args) {
                System.out.print("Called: " + method.getName());
                return super.beforeMethodStarts(proxy, method, args);
            }
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.