Package org.apache.tapestry5.ioc.util

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


            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())
View Full Code Here


            builder.addln(");");

            if (isVoid)
                builder.addln("return success(null);");

            builder.end(); // try
            builder.addln("catch (java.lang.RuntimeException ex) { throw ex; }");
            builder.addln("catch (java.lang.Exception ex) { return fail(ex); }");

            builder.end();
View Full Code Here

            builder.end(); // try
            builder.addln("catch (java.lang.RuntimeException ex) { throw ex; }");
            builder.addln("catch (java.lang.Exception ex) { return fail(ex); }");

            builder.end();

            return instantiateMethodAccessFromBody(builder.toString());
        }

        private MethodAccess instantiateMethodAccessFromBody(String body)
View Full Code Here

                builder.add("$%d", i + 2);
            }

            builder.addln(");");

            builder.end();

            addNewMethod(accessMethodSignature, builder.toString());

            return methodName;
        }
View Full Code Here

            BodyBuilder builder = new BodyBuilder().begin();

            builder.addln("%s instance = (%<s) $1;", getClassName());
            builder.addln("return ($w) instance.%s();", readAccess.getName());

            builder.end();

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

        private void addFieldAccessWriteMethod(ClassFab cf, TransformMethod writeAccess)
View Full Code Here

            builder.addln("%s instance = (%<s) $1;", getClassName());
            builder.addln("%s value = %s;", type, ClassFabUtils.castReference("$2", type));
            builder.addln("instance.%s(value);", writeAccess.getName());

            builder.end();

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

        private TransformMethod createReader()
View Full Code Here

                builder.addln("%s = $%d;", p.getFieldName(), index++);
            }


            builder.end();

            Class[] arrayOfTypes = types.toArray(new Class[0]);


            classFab.addConstructor(arrayOfTypes, null, builder.toString());
View Full Code Here

                    "if (root == null) throw new NullPointerException(\"Root object of property expression '%s' is null.\");",
                    expression);

            builder.addln("return root;");

            builder.end();

            MethodSignature sig = new MethodSignature(rootType, "getRoot", new Class[] { Object.class }, null);

            classFab.addMethod(Modifier.PRIVATE, sig, builder.toString());
        }
View Full Code Here

            addRootVariable(builder);

            builder.addln("return %s;", createMethodInvocation(builder, node, 0, RANGE));

            builder.end();

            classFab.addMethod(Modifier.PUBLIC, GET_SIGNATURE, builder.toString());
        }

        private void createNotOpGetter(Tree node)
View Full Code Here

            addRootVariable(builder);

            builder.addln("return ($w) %s;", createMethodInvocation(builder, node, 0, INVERT));

            builder.end();

            classFab.addMethod(Modifier.PUBLIC, GET_SIGNATURE, builder.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.