Examples of TransformMethodSignature


Examples of org.apache.tapestry.services.TransformMethodSignature

        assertEquals(subclassFieldName, parentFieldName);

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

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

        ct.finish();

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

Examples of org.apache.tapestry.services.TransformMethodSignature

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

        TransformMethodSignature readMethodSignature = new TransformMethodSignature(
                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;

        TransformMethodSignature writeMethodSignature = new TransformMethodSignature(
                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

Examples of org.apache.tapestry.services.TransformMethodSignature

        replay();

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

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

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

        assertEquals(annotation.value(), "fred");
View Full Code Here

Examples of org.apache.tapestry.services.TransformMethodSignature

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

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

Examples of org.apache.tapestry.services.TransformMethodSignature

    }
   
    @Test
    public void prefix_method() throws Exception {
        Logger logger = mockLogger();
        TransformMethodSignature sig = new TransformMethodSignature(Modifier.PUBLIC, "int", "getParentField", null, null);
       
        replay();
       
        InternalClassTransformation ct = createClassTransformation(ParentClass.class, logger);
        ct.prefixMethod(sig, "return 42;");
View Full Code Here

Examples of org.apache.tapestry.services.TransformMethodSignature

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

        assertEquals(sigs.size(), 1);

        TransformMethodSignature 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

Examples of org.apache.tapestry.services.TransformMethodSignature

    public void no_methods_with_annotation()
    {
        ClassTransformation tf = mockClassTransformation();
        MutableComponentModel model = mockMutableComponentModel();

        TransformMethodSignature sig = new TransformMethodSignature("someRandomMethod");

        train_findMethods(tf, sig);

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

Examples of org.apache.tapestry.services.TransformMethodSignature

    {
        ClassTransformation tf = mockClassTransformation();
        MutableComponentModel model = mockMutableComponentModel();
        SetupRender annotation = newSetupRender();

        TransformMethodSignature sig = new TransformMethodSignature("aMethod");

        train_findMethods(tf, sig);

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

Examples of org.apache.tapestry.services.TransformMethodSignature

    public void match_on_method_name()
    {
        ClassTransformation tf = mockClassTransformation();
        MutableComponentModel model = mockMutableComponentModel();

        TransformMethodSignature sig = new TransformMethodSignature("setupRender");

        train_findMethods(tf, sig);

        train_isRootClass(model, false);
View Full Code Here

Examples of org.apache.tapestry.services.TransformMethodSignature

    {
        ClassTransformation tf = mockClassTransformation();
        MutableComponentModel model = mockMutableComponentModel();
        SetupRender annotation = newSetupRender();

        TransformMethodSignature siga = new TransformMethodSignature("aMethod");
        TransformMethodSignature sigb = new TransformMethodSignature("bMethod");

        train_findMethods(tf, siga, sigb);

        train_getMethodAnnotation(tf, siga, SetupRender.class, annotation);
        train_getMethodAnnotation(tf, sigb, SetupRender.class, annotation);
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.