Package org.apache.tapestry5.plastic

Examples of org.apache.tapestry5.plastic.PlasticMethod


     * the two methods call each other are added.
     */
    private void addBridgeMethod(PlasticClass plasticClass, PlasticField filterField, PlasticField nextField,
            final MethodSignature ms, List filterMethods)
    {
        PlasticMethod method = plasticClass.introduceMethod(ms.getMethod());

        Iterator i = filterMethods.iterator();

        while (i.hasNext())
        {
            MethodSignature fms = (MethodSignature) i.next();

            int position = filterMethodAnalyzer.findServiceInterfacePosition(ms, fms);

            if (position >= 0)
            {
                bridgeServiceMethodToFilterMethod(method, filterField, nextField, position, ms, fms);
                i.remove();
                return;
            }
        }

        method.changeImplementation(new InstructionBuilderCallback()
        {
            public void doBuild(InstructionBuilder builder)
            {
                String message = ServiceMessages.unmatchedServiceMethod(ms, filterInterface);

View Full Code Here


            public void transform(PlasticClass plasticClass)
            {
                final PlasticField objectCreatorField = plasticClass.introduceField(ObjectCreator.class, "creator")
                        .injectFromInstanceContext();

                PlasticMethod delegateMethod = plasticClass.introducePrivateMethod(interfaceType.getName(), "delegate",
                        null, null);

                delegateMethod.changeImplementation(new InstructionBuilderCallback()
                {
                    @Override
                    public void doBuild(InstructionBuilder builder)
                    {
                        builder.loadThis().getField(objectCreatorField);
View Full Code Here

        Import annotation = componentClass.getAnnotation(Import.class);

        if (annotation == null)
            return;

        PlasticMethod setupRender = componentClass.introduceMethod(TransformConstants.SETUP_RENDER_DESCRIPTION);

        decorateMethod(componentClass, model, setupRender, annotation);

        model.addRenderPhase(SetupRender.class);
    }
View Full Code Here

    public TransformMethod getOrCreateMethod(TransformMethodSignature signature)
    {
        MethodDescription md = toMethodDescription(signature);

        PlasticMethod plasticMethod = plasticClass.introduceMethod(md);

        return new BridgeTransformMethod(plasticMethod);
    }
View Full Code Here

                        creator);

                final PlasticField tokenField = plasticClass.introduceField(ServiceProxyToken.class, "token").inject(
                        token);

                PlasticMethod delegateMethod = plasticClass.introducePrivateMethod(serviceInterface.getName(),
                        "delegate", null, null);

                // If not concerned with efficiency, this might be done with method advice instead.
                delegateMethod.changeImplementation(new InstructionBuilderCallback()
                {
                    public void doBuild(InstructionBuilder builder)
                    {
                        builder.loadThis().getField(plasticClass.getClassName(), creatorField.getName(),
                                ObjectCreator.class);
View Full Code Here

            public void transform(PlasticClass plasticClass)
            {
                final PlasticField objectCreatorField = plasticClass.introduceField(ObjectCreator.class, "creator")
                        .inject(creator);

                PlasticMethod delegateMethod = plasticClass.introducePrivateMethod(interfaceType.getName(), "delegate",
                        null, null);

                delegateMethod.changeImplementation(new InstructionBuilderCallback()
                {
                    public void doBuild(InstructionBuilder builder)
                    {
                        builder.loadThis().getField(objectCreatorField);
                        builder.invoke(ObjectCreator.class, Object.class, "createObject");
View Full Code Here

        List<PlasticMethod> result = getMethods();
        Iterator<PlasticMethod> iterator = result.iterator();

        while (iterator.hasNext())
        {
            PlasticMethod method = iterator.next();

            if (!method.hasAnnotation(annotationType))
                iterator.remove();
        }

        return result;
    }
View Full Code Here

        if (Modifier.isAbstract(description.modifiers))
        {
            description = description.withModifiers(description.modifiers & ~ACC_ABSTRACT);
        }

        PlasticMethod result = description2method.get(description);

        if (result == null)
        {
            result = createNewMethod(description);
View Full Code Here

    {
      /**
       * It seems that Tapestry ignores the annotation method when it is overridden
       * So we choose the cleanupRender phase as it is the method that has less chance to be annotated with @Goal 
       * */
      PlasticMethod cleanupRender = componentClass.introduceMethod(TransformConstants.CLEANUP_RENDER_DESCRIPTION);

      decorateMethodForAddingScript(componentClass, model, cleanupRender, annotation);

      model.addRenderPhase(CleanupRender.class);
    }
View Full Code Here

    {
      /**
       * It seems that Tapestry ignores the method annotation when you override the method
       * So we choose to override the cleanupRender phase as it has less chance to be annotated with @Genetify 
       * */
      PlasticMethod cleanupRender = componentClass.introduceMethod(TransformConstants.CLEANUP_RENDER_DESCRIPTION);

      decorateMethodForAddingScript(componentClass, model, cleanupRender, annotation);

      model.addRenderPhase(CleanupRender.class);
    }
View Full Code Here

TOP

Related Classes of org.apache.tapestry5.plastic.PlasticMethod

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.