Package org.apache.tapestry.ioc.services

Examples of org.apache.tapestry.ioc.services.ClassFab.addMethod()


        if (eagerLoad)
        {
            cf.addInterface(EagerLoadServiceProxy.class);

            cf.addMethod(Modifier.PUBLIC, new MethodSignature(void.class, "eagerLoadService", null,
                    null), "_delegate();");
        }

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


        MethodSignature setStringValue = new MethodSignature(void.class, "setStringValue",
                new Class[]
                { String.class }, null);

        cf.addMethod(Modifier.PUBLIC, setStringValue, "_stringValue = $1;");

        MethodSignature getStringValue = new MethodSignature(String.class, "getStringValue", null,
                null);

        cf.addMethod(Modifier.PUBLIC, getStringValue, "return _stringValue;");
View Full Code Here

        cf.addMethod(Modifier.PUBLIC, setStringValue, "_stringValue = $1;");

        MethodSignature getStringValue = new MethodSignature(String.class, "getStringValue", null,
                null);

        cf.addMethod(Modifier.PUBLIC, getStringValue, "return _stringValue;");

        Class targetClass = cf.createClass();

        Object targetBean = targetClass.newInstance();
View Full Code Here

        { String.class }, null, "{ _stringValue = $1; }");

        MethodSignature getStringValue = new MethodSignature(String.class, "getStringValue", null,
                null);

        cf.addMethod(Modifier.PUBLIC, getStringValue, "return _stringValue;");

        Class targetClass = cf.createClass();

        try
        {
View Full Code Here

        cf.addField("_intValue", int.class);
        cf.addConstructor(new Class[]
        { int.class }, null, "{ _intValue = $1; }");

        cf.addMethod(
                Modifier.PUBLIC,
                new MethodSignature(int.class, "getIntValue", null, null),
                "return _intValue;");

        Class targetClass = cf.createClass();
View Full Code Here

    {
        ClassFab cf = newClassFab("SimpleService", Object.class);

        cf.addInterface(SimpleService.class);

        cf.addMethod(Modifier.PUBLIC, new MethodSignature(int.class, "add", new Class[]
        { int.class, int.class }, null), "return $1 + $2;");

        Class targetClass = cf.createClass();

        SimpleService s = (SimpleService) targetClass.newInstance();
View Full Code Here

        cf.addInterface(Runnable.class);

        try
        {
            cf.addMethod(
                    Modifier.PUBLIC,
                    new MethodSignature(void.class, "run", null, null),
                    "fail;");
        }
        catch (RuntimeException ex)
View Full Code Here

    @Test
    public void add_duplicate_method_signature() throws Exception
    {
        ClassFab cf = newClassFab("DupeMethodAdd", Object.class);

        cf.addMethod(Modifier.PUBLIC, new MethodSignature(void.class, "foo", null, null), "{}");

        try
        {
            cf.addMethod(Modifier.PUBLIC, new MethodSignature(void.class, "foo", null, null), "{}");
            unreachable();
View Full Code Here

        cf.addMethod(Modifier.PUBLIC, new MethodSignature(void.class, "foo", null, null), "{}");

        try
        {
            cf.addMethod(Modifier.PUBLIC, new MethodSignature(void.class, "foo", null, null), "{}");
            unreachable();
        }
        catch (RuntimeException ex)
        {
            assertEquals("Attempt to redefine method void foo() of class DupeMethodAdd.", ex
View Full Code Here

        MethodSignature sig = new MethodSignature(Map.class, "doTheNasty", new Class[]
        { int.class, String.class }, new Class[]
        { InstantiationException.class, IllegalAccessException.class });

        cf.addMethod(
                Modifier.PUBLIC + Modifier.FINAL + Modifier.SYNCHRONIZED,
                sig,
                "{ return _map; }");

        String toString = cf.toString();
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.