Package org.apache.tapestry.ioc.services

Examples of org.apache.tapestry.ioc.services.MethodIterator


    }

    private void addMethods(ClassFab cf, Class commandInterface)
    {
        MethodIterator mi = new MethodIterator(commandInterface);

        while (mi.hasNext())
        {
            MethodSignature sig = mi.next();

            addMethod(cf, commandInterface, sig);
        }

        if (!mi.getToString())
            cf.addToString(format("<Command chain of %s>", commandInterface.getName()));
    }
View Full Code Here


    {
        _lock.check();

        addInterface(serviceInterface);

        MethodIterator mi = new MethodIterator(serviceInterface);

        while (mi.hasNext())
        {
            MethodSignature sig = mi.next();

            // ($r) properly handles void methods for us, which keeps this simple.

            String body = format("return ($r) %s.%s($$);", delegateExpression, sig.getName());

            addMethod(Modifier.PUBLIC, sig, body);
        }

        if (!mi.getToString()) addToString(toString);
    }
View Full Code Here

        return cf.createClass();
    }

    private void addMethods(ClassFab cf, Class serviceInterface, String serviceId)
    {
        MethodIterator mi = new MethodIterator(serviceInterface);

        while (mi.hasNext())
            addMethod(cf, mi.next());

        if (!mi.getToString())
            cf.addToString(ServiceMessages.loggingInterceptor(serviceId, serviceInterface));
    }
View Full Code Here

        List<MethodSignature> serviceMethods = newList();
        List<MethodSignature> filterMethods = newList();

        createInfrastructure();

        MethodIterator mi = new MethodIterator(_serviceInterface);

        while (mi.hasNext())
        {
            serviceMethods.add(mi.next());
        }

        boolean toStringMethodExists = mi.getToString();

        mi = new MethodIterator(_filterInterface);

        while (mi.hasNext())
        {
            filterMethods.add(mi.next());
        }

        while (!serviceMethods.isEmpty())
        {
            MethodSignature ms = serviceMethods.remove(0);
View Full Code Here

        cf.addConstructor(new Class[]
        { StrategyRegistry.class }, null, "_registry = $1;");

        BodyBuilder builder = new BodyBuilder();

        MethodIterator mi = new MethodIterator(interfaceClass);

        while (mi.hasNext())
        {
            MethodSignature sig = mi.next();

            // TODO: Checks for methods that don't have at least one parameter, or don't have a
            // compatible 1st parameter. Currently, we'll get a Javassist exception.

            builder.clear();
            builder.begin();

            builder.addln("Object selector = $1;");
            builder.addln(
                    "%s adapter = (%<s) _registry.getByInstance(selector);",
                    interfaceClassName);
            builder.addln("return ($r) adapter.%s($$);", sig.getName());

            builder.end();

            cf.addMethod(Modifier.PUBLIC, sig, builder.toString());

        }

        if (!mi.getToString())
            cf.addToString(String.format("<Strategy for %s>", interfaceClassName));

        return cf.createClass();
    }
View Full Code Here

    @SuppressWarnings("unchecked")
    private <S> Class<S> createClass(Class<S> serviceInterface)
    {
        ClassFab cf = _classFactory.newClass(serviceInterface);

        MethodIterator mi = new MethodIterator(serviceInterface);

        while (mi.hasNext())
        {
            MethodSignature sig = mi.next();

            cf.addNoOpMethod(sig);
        }

        if (!mi.getToString()) cf.addToString(format("<NoOp %s>", serviceInterface.getName()));

        return cf.createClass();
    }
View Full Code Here

    }

    private void addMethods(ClassFab cf, Class commandInterface)
    {
        MethodIterator mi = new MethodIterator(commandInterface);

        while (mi.hasNext())
        {
            MethodSignature sig = mi.next();

            addMethod(cf, commandInterface, sig);
        }

        if (!mi.getToString())
            cf.addToString(format("<Command chain of %s>", commandInterface.getName()));
    }
View Full Code Here

    {
        _lock.check();

        addInterface(serviceInterface);

        MethodIterator mi = new MethodIterator(serviceInterface);

        while (mi.hasNext())
        {
            MethodSignature sig = mi.next();

            // ($r) properly handles void methods for us, which keeps this simple.

            String body = format("return ($r) %s.%s($$);", delegateExpression, sig.getName());

            addMethod(Modifier.PUBLIC, sig, body);
        }

        if (!mi.getToString())
            addToString(toString);
    }
View Full Code Here

        return cf.createClass();
    }

    private void addMethods(ClassFab cf, Class serviceInterface, String serviceId)
    {
        MethodIterator mi = new MethodIterator(serviceInterface);

        while (mi.hasNext())
            addMethod(cf, mi.next());

        if (!mi.getToString())
            cf.addToString(ServiceMessages.loggingInterceptor(serviceId, serviceInterface));
    }
View Full Code Here

        List<MethodSignature> serviceMethods = newList();
        List<MethodSignature> filterMethods = newList();

        createInfrastructure();

        MethodIterator mi = new MethodIterator(_serviceInterface);

        while (mi.hasNext())
        {
            serviceMethods.add(mi.next());
        }

        boolean toStringMethodExists = mi.getToString();

        mi = new MethodIterator(_filterInterface);

        while (mi.hasNext())
        {
            filterMethods.add(mi.next());
        }

        while (!serviceMethods.isEmpty())
        {
            MethodSignature ms = serviceMethods.remove(0);
View Full Code Here

TOP

Related Classes of org.apache.tapestry.ioc.services.MethodIterator

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.