Package org.apache.tapestry5.services

Examples of org.apache.tapestry5.services.TransformMethodSignature


    private final HeartbeatDeferredWorker worker = new HeartbeatDeferredWorker(null);

    @Test
    public void non_void_method_will_fail()
    {
        testFailure(new TransformMethodSignature(Modifier.PUBLIC, "java.lang.String", "shouldReturnVoid", null, null),
                "as it is not a void method");
    }
View Full Code Here


    }

    @Test
    public void checked_exceptions_will_fail()
    {
        testFailure(new TransformMethodSignature(Modifier.PUBLIC, "void", "noCheckedExceptions", null, new String[]
        { "java.lang.Exception" }), "as it throws checked exceptions");
    }
View Full Code Here

            addSetter(transformation, field, propertyName);
    }

    private void addSetter(ClassTransformation transformation, TransformField field, String propertyName)
    {
        TransformMethodSignature setter = new TransformMethodSignature(Modifier.PUBLIC, "void", "set" + propertyName,
                new String[]
                { field.getType() }, null);

        ensureNotOverride(transformation, setter);
View Full Code Here

                            .getClassName()));
    }

    private void addGetter(ClassTransformation transformation, TransformField field, String propertyName)
    {
        TransformMethodSignature getter = new TransformMethodSignature(Modifier.PUBLIC, field.getType(), "get"
                + propertyName, null, null);

        ensureNotOverride(transformation, getter);

        final FieldAccess access = field.getAccess();
View Full Code Here

        String methodName = method.getName();

        String eventType = extractEventType(methodName, annotation);
        String componentId = extractComponentId(methodName, annotation);

        final TransformMethodSignature signature = method.getSignature();

        String[] parameterTypes = signature.getParameterTypes();

        if (parameterTypes.length == 0)
            return new BaseEventHandlerMethodInvoker(method, eventType, componentId);

        final List<EventHandlerMethodParameterSource> sources = CollectionFactory.newList();
View Full Code Here

        };
    }

    private void validateMethodSignature(TransformMethod method)
    {
        TransformMethodSignature signature = method.getSignature();

        if (!signature.getReturnType().equals("void"))
            throw new RuntimeException(String.format("Method %s is a lifecycle method and should return void.", method
                    .getMethodIdentifier()));

        if (signature.getParameterTypes().length > 0)
            throw new RuntimeException(String.format("Method %s is a lifecycle method and should take no parameters.",
                    method.getMethodIdentifier()));
    }
View Full Code Here

    private void mapMethodsToRenderPhase(ClassTransformation transformation, MutableComponentModel model,
            Class annotationType, List<TransformMethod> methods)
    {
        ComponentMethodAdvice renderPhaseAdvice = createAdviceForMethods(annotationType, methods);

        TransformMethodSignature renderPhaseSignature = annotationToSignature.get(annotationType);

        transformation.getOrCreateMethod(renderPhaseSignature).addAdvice(renderPhaseAdvice);

        model.addRenderPhase(annotationType);
    }
View Full Code Here

        {
            public void transform(ClassTransformation transformation, MutableComponentModel model)
            {
                transformation.addImplementedInterface(Runnable.class);

                TransformMethodSignature targetMethodSignature = new TransformMethodSignature(Modifier.PROTECTED,
                        "void", "protectedVoidNoArgs", null, null);
                TransformMethod pvna = transformation.getOrCreateMethod(targetMethodSignature);

                final MethodAccess pvnaAccess = pvna.getAccess();
View Full Code Here

        {
            public void transform(ClassTransformation transformation, MutableComponentModel model)
            {
                transformation.addImplementedInterface(Runnable.class);

                TransformMethodSignature targetMethodSignature = new TransformMethodSignature(Modifier.PUBLIC, "void",
                        "publicVoidThrowsException", null, new String[]
                        { SQLException.class.getName() });
                TransformMethod targetMethod = transformation.getOrCreateMethod(targetMethodSignature);

                final MethodAccess targetAccess = targetMethod.getAccess();
View Full Code Here

        {
            public void transform(ClassTransformation transformation, MutableComponentModel model)
            {
                transformation.addImplementedInterface(ProcessInteger.class);

                TransformMethod incrementer = transformation.getOrCreateMethod(new TransformMethodSignature(
                        Modifier.PUBLIC, "int", "incrementer", new String[]
                        { "int" }, null));

                final MethodAccess incrementerAccess = incrementer.getAccess();

                TransformMethodSignature operateSig = new TransformMethodSignature(Modifier.PUBLIC, "int", "operate",
                        new String[]
                        { "int" }, null);

                TransformMethod operate = transformation.getOrCreateMethod(operateSig);
View Full Code Here

TOP

Related Classes of org.apache.tapestry5.services.TransformMethodSignature

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.