Package org.apache.tapestry.services

Examples of org.apache.tapestry.services.MethodSignature


    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(), "fred");
        assertEquals(annotation.component(), "alpha");
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

    {
        ClassTransformation transformation = mockClassTransformation();

        replay();

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

        MethodInvocationBuilder invoker = new MethodInvocationBuilder();

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

    {
        ClassTransformation transformation = mockClassTransformation();

        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 = mockClassTransformation();

        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

        _resourcesFieldName = addInjectedFieldUncached(
                InternalComponentResources.class,
                "resources",
                null);

        MethodSignature sig = new MethodSignature(Modifier.PUBLIC | Modifier.FINAL,
                ComponentResources.class.getName(), "getComponentResources", null, null);

        addMethod(sig, "return " + _resourcesFieldName + ";");
    }
View Full Code Here

            newMethod.setBody(null);

            _ctClass.addMethod(newMethod);

            MethodSignature sig = getMethodSignature(newMethod);

            addMethodToDescription("add default", sig, "<default>");
        }
        catch (CannotCompileException ex)
        {
View Full Code Here

        {
            List<Annotation> annotations = findMethodAnnotations(method);

            if (findAnnotationInList(annotationClass, annotations) != null)
            {
                MethodSignature sig = getMethodSignature(method);
                result.add(sig);
            }
        }

        Collections.sort(result);
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.