Package org.apache.tapestry.ioc.util

Examples of org.apache.tapestry.ioc.util.BodyBuilder.end()


            transformation.makeReadOnly(fieldName);
            transformation.claimField(fieldName, annotation);
        }

        builder.end();

        transformation.extendMethod(TransformConstants.CONTAINING_PAGE_DID_LOAD_SIGNATURE, builder
                .toString());
    }
View Full Code Here


        builder.begin();

        for (TransformMethodSignature method : methods)
            addCodeForMethod(builder, method, transformation);

        builder.end(); // try

        // Runtime exceptions pass right through.

        builder.addln("catch (RuntimeException ex) { throw ex; }");
View Full Code Here

        // Wrap others in a RuntimeException to communicate them up.

        builder.addln("catch (Exception ex) { throw new RuntimeException(ex); } ");

        builder.end();

        transformation.extendMethod(TransformConstants.DISPATCH_COMPONENT_EVENT, builder.toString());
    }

    private void addCodeForMethod(BodyBuilder builder, TransformMethodSignature method,
View Full Code Here

        builder.begin();
        builder.addln("result = _commands[i].%s($$);", sig.getName());

        builder.addln("if (result != %s) break;", defaultValue);

        builder.end();

        builder.addln("return result;");
        builder.end();

        cf.addMethod(Modifier.PUBLIC, sig, builder.toString());
View Full Code Here

        builder.addln("if (result != %s) break;", defaultValue);

        builder.end();

        builder.addln("return result;");
        builder.end();

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

    private String defaultForReturnType(Class returnType)
View Full Code Here

        builder.begin();

        builder.addln("for (int i = 0; i < _commands.length; i++)");
        builder.addln("  _commands[i].%s($$);", sig.getName());

        builder.end();

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

}
View Full Code Here

        builder.addln(
                "%s.persistFieldChange(\"%s\", ($w) $1);",
                resourcesFieldName,
                logicalFieldName);
        builder.addln("%s = $1;", fieldName);
        builder.end();

        transformation.addMethod(new TransformMethodSignature(Modifier.PRIVATE, "void", writeMethodName,
                                                              new String[]
                                                                      {fieldType}, null), builder.toString());
View Full Code Here

        if (unwrapMethodName == null)
            builder.addln(";");
        else
            builder.addln(".%s();", unwrapMethodName);

        builder.end();

        transformation.extendMethod(
                TransformConstants.CONTAINING_PAGE_DID_ATTACH_SIGNATURE,
                builder.toString());
View Full Code Here

            builder.addln("if (debug)");
            builder.addln(format("  _logger.exit(%s, ($w)result);", name));
            builder.addln("return result;");
        }

        builder.end(); // try

        // Now, a catch for each declared exception (if any)

        if (signature.getExceptionTypes() != null)
            for (Class exceptionType : signature.getExceptionTypes())
View Full Code Here

        // And a catch for RuntimeException

        addExceptionHandler(builder, name, RuntimeException.class);

        builder.end();

        cf.addMethod(Modifier.PUBLIC, signature, builder.toString());
    }

    private void addExceptionHandler(BodyBuilder builder, String quotedMethodName,
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.