Package org.apache.tapestry.services

Examples of org.apache.tapestry.services.MethodSignature


    {
        ClassTransformation transformation = newClassTransformation();

        replay();

        MethodSignature sig = new MethodSignature(Modifier.PUBLIC, "void", "myMethod", new String[]
        { MARKUP_WRITER_CLASS_NAME }, null);

        MethodInvocationBuilder invoker = new MethodInvocationBuilder();

        assertEquals(invoker.buildMethodInvocation(sig, transformation), "myMethod(null)");
View Full Code Here


    {
        ClassTransformation transformation = newClassTransformation();

        replay();

        MethodSignature sig = new MethodSignature(Modifier.PUBLIC, "void", "myMethod", new String[]
        { MARKUP_WRITER_CLASS_NAME, LOCALE_CLASS_NAME }, null);

        MethodInvocationBuilder invoker = new MethodInvocationBuilder();

        invoker.addParameter(MARKUP_WRITER_CLASS_NAME, "$1");
View Full Code Here

        assertEquals(subclassFieldName, parentFieldName);

        // This proves the the field is protected and can be used in subclasses.

        ct.addMethod(new MethodSignature(Modifier.PUBLIC, "java.lang.String", "getValue", null,
                null), "return " + subclassFieldName + ";");

        ct.finish();

        Class transformed = _classPool.toClass(subclassCtClass, _loader);
View Full Code Here

    private void replaceAccessToField(InternalClassTransformation ct, String baseName)
    {
        String fieldName = "_" + baseName;
        String readMethodName = "_read_" + baseName;

        MethodSignature readMethodSignature = new MethodSignature(Modifier.PRIVATE,
                STRING_CLASS_NAME, readMethodName, null, null);

        ct.addMethod(readMethodSignature, String.format(
                "throw new RuntimeException(\"read %s\");",
                baseName));

        ct.replaceReadAccess(fieldName, readMethodName);

        String writeMethodName = "_write_" + baseName;

        MethodSignature writeMethodSignature = new MethodSignature(Modifier.PRIVATE, "void",
                writeMethodName, new String[]
                { STRING_CLASS_NAME }, null);
        ct.addMethod(writeMethodSignature, String.format(
                "throw new RuntimeException(\"write %s\");",
                baseName));
View Full Code Here

        replay();

        ClassTransformation ct = createClassTransformation(EventHandlerTarget.class, log);

        OnEvent annotation = ct.getMethodAnnotation(new MethodSignature("handler"), OnEvent.class);

        // Check that the attributes of the annotation match the expectation.

        assertEquals(annotation.value(), new String[]
        { "fred", "barney" });
View Full Code Here

        ClassTransformation ct = createClassTransformation(ParentClass.class, log);

        try
        {
            ct.getMethodAnnotation(new MethodSignature("foo"), OnEvent.class);
            unreachable();
        }
        catch (IllegalArgumentException ex)
        {
            assertEquals(
View Full Code Here

        List<MethodSignature> sigs = ct.findMethodsWithAnnotation(OnEvent.class);

        assertEquals(sigs.size(), 1);

        MethodSignature sig = sigs.get(0);

        assertEquals(
                ct.getMethodIdentifier(sig),
                "org.apache.tapestry.internal.transform.pages.MethodIdentifier.makeWaves(java.lang.String, int[]) (at MethodIdentifier.java:24)");
View Full Code Here

    public void no_methods_with_annotation()
    {
        ClassTransformation tf = newClassTransformation();
        MutableComponentModel model = newMutableComponentModel();

        MethodSignature sig = new MethodSignature("someRandomMethod");

        train_findMethods(tf, sig);

        train_getMethodAnnotation(tf, sig, SetupRender.class, null);
View Full Code Here

    {
        ClassTransformation tf = newClassTransformation();
        MutableComponentModel model = newMutableComponentModel();
        SetupRender annotation = newSetupRender();

        MethodSignature sig = new MethodSignature("aMethod");

        train_findMethods(tf, sig);

        train_getMethodAnnotation(tf, sig, SetupRender.class, annotation);
View Full Code Here

    public void match_on_method_name()
    {
        ClassTransformation tf = newClassTransformation();
        MutableComponentModel model = newMutableComponentModel();

        MethodSignature sig = new MethodSignature("setupRender");

        train_findMethods(tf, sig);

        train_isRootClass(model, false);
View Full Code Here

TOP

Related Classes of org.apache.tapestry.services.MethodSignature

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.