Examples of PlasticField


Examples of org.apache.tapestry5.plastic.PlasticField

        {
            public void transform(final PlasticClass plasticClass)
            {
                plasticClass.introduceInterface(Serializable.class);

                final PlasticField creatorField = plasticClass.introduceField(ObjectCreator.class, "creator").inject(
                        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);
                        builder.invoke(ObjectCreator.class, Object.class, "createObject").checkcast(serviceInterface)
                                .returnResult();
                    }
                });

                for (Method m : serviceInterface.getMethods())
                {
                    plasticClass.introduceMethod(m).delegateTo(delegateMethod);
                }

                plasticClass.introduceMethod(WRITE_REPLACE).changeImplementation(new InstructionBuilderCallback()
                {
                    public void doBuild(InstructionBuilder builder)
                    {
                        builder.loadThis()
                                .getField(plasticClass.getClassName(), tokenField.getName(), ServiceProxyToken.class)
                                .returnResult();
                    }
                });

                plasticClass.addToString(description);
View Full Code Here

Examples of org.apache.tapestry5.plastic.PlasticField

        ClassInstantiator<T> instantiator = createProxy(interfaceType, new PlasticClassTransformer()
        {
            public void transform(PlasticClass plasticClass)
            {
                final PlasticField objectCreatorField = plasticClass.introduceField(ObjectCreator.class, "creator")
                        .inject(creator);

                PlasticMethod delegateMethod = plasticClass.introducePrivateMethod(interfaceType.getName(), "delegate",
                        null, null);
View Full Code Here

Examples of org.apache.tapestry5.plastic.PlasticField

        Iterator<PlasticField> iterator = result.iterator();

        while (iterator.hasNext())
        {
            PlasticField plasticField = iterator.next();

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

        return result;
    }
View Full Code Here

Examples of org.apache.tapestry5.plastic.PlasticField

            verifyInitialState("set the computed FieldConduit for");

            // First step: define a field to store the conduit and add constructor logic
            // to initialize it

            PlasticField conduitField = introduceField(FieldConduit.class, node.name + "_FieldConduit").injectComputed(
                    computedConduit);

            replaceFieldReadAccess(conduitField.getName());
            replaceFieldWriteAccess(conduitField.getName());

            // TODO: Do we keep the field or not? It will now always be null/0/false.

            state = FieldState.CONDUIT;
View Full Code Here

Examples of org.apache.tapestry5.plastic.PlasticField

            plasticClass.addToString(String.format("PropertyConduit[%s %s]", rootType.getName(), expression));
        }

        private void implementOtherMethods()
        {
            PlasticField annotationProviderField = plasticClass.introduceField(AnnotationProvider.class,
                    "annotationProvider").inject(annotationProvider);

            plasticClass.introduceMethod(ConduitMethods.GET_ANNOTATION).delegateTo(annotationProviderField);

            plasticClass.introduceMethod(ConduitMethods.GET_PROPERTY_NAME, new InstructionBuilderCallback()
            {
                public void doBuild(InstructionBuilder builder)
                {
                    builder.loadConstant(conduitPropertyName).returnResult();
                }
            });

            final PlasticField propertyTypeField = plasticClass.introduceField(Class.class, "propertyType").inject(
                    conduitPropertyType);

            plasticClass.introduceMethod(ConduitMethods.GET_PROPERTY_TYPE, new InstructionBuilderCallback()
            {
                public void doBuild(InstructionBuilder builder)
View Full Code Here

Examples of org.apache.tapestry5.plastic.PlasticField

      PlasticMethod method, com.adaptivui.tapestry5.genetify.data.Goal goal, Worker<com.adaptivui.tapestry5.genetify.data.Goal> operation)
  {
    if (goal == null)
      return;

    PlasticField goalField = componentClass.introduceField(com.adaptivui.tapestry5.genetify.data.Goal.class,
        "goal_" + method.getDescription().methodName);

    initializeGoal(method, goal, goalField);

    addMethodGoalOperationAdvice(method, goalField.getHandle(), operation);
  }
View Full Code Here

Examples of org.apache.tapestry5.plastic.PlasticField

      PlasticMethod method, GeneType[] geneTypes, Worker<GeneType> operation)
  {
    if (geneTypes == null || geneTypes.length == 0)
      return;

    PlasticField geneTypesField = componentClass.introduceField(GeneType[].class,
        "varyTypes_" + method.getDescription().methodName);

    initializeGeneTypes(model.getBaseResource(), geneTypes, geneTypesField);

    addMethodGeneTypesOperationAdvice(method, geneTypesField.getHandle(), operation);
  }
View Full Code Here

Examples of org.apache.tapestry5.plastic.PlasticField

    {
        return proxyFactory.createProxy(interfaceType, new PlasticClassTransformer()
        {
            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()
                {
                    public void doBuild(InstructionBuilder builder)
                    {
                        builder.loadThis().getField(objectCreatorField);
                        builder.invoke(CREATE_OBJECT);
                        builder.checkcast(interfaceType).returnResult();
                    }
                });

                for (Method method : interfaceType.getMethods())
                {
                    plasticClass.introduceMethod(method).delegateTo(delegateMethod);
                }

                if (!plasticClass.isMethodImplemented(PlasticUtils.TO_STRING_DESCRIPTION))
                {
                    final PlasticField descriptionField = plasticClass.introduceField(String.class, "description")
                            .injectFromInstanceContext();

                    plasticClass.introduceMethod(PlasticUtils.TO_STRING_DESCRIPTION, new InstructionBuilderCallback()
                    {
                        public void doBuild(InstructionBuilder builder)
View Full Code Here

Examples of org.apache.tapestry5.plastic.PlasticField

        plasticClass.addToString(description);

        allMethods.addAll(Arrays.asList(serviceInterface.getMethods()));

        final PlasticField delegateField = plasticClass.introduceField(serviceInterface, "delegate").inject(delegate);

        for (Method method : allMethods)
        {
            plasticClass.introduceMethod(method).delegateTo(delegateField);
        }
View Full Code Here

Examples of org.apache.tapestry5.plastic.PlasticField

            plasticClass.addToString(String.format("PropertyConduit[%s %s]", rootType.getName(), expression));
        }

        private void implementOtherMethods()
        {
            PlasticField annotationProviderField = plasticClass.introduceField(AnnotationProvider.class,
                    "annotationProvider").inject(annotationProvider);

            plasticClass.introduceMethod(ConduitMethods.GET_ANNOTATION).delegateTo(annotationProviderField);

            plasticClass.introduceMethod(ConduitMethods.GET_PROPERTY_NAME, new InstructionBuilderCallback()
            {
                public void doBuild(InstructionBuilder builder)
                {
                    builder.loadConstant(conduitPropertyName).returnResult();
                }
            });

            final PlasticField propertyTypeField = plasticClass.introduceField(Class.class, "propertyType").inject(
                    conduitPropertyType);

            plasticClass.introduceMethod(ConduitMethods.GET_PROPERTY_TYPE, new InstructionBuilderCallback()
            {
                public void doBuild(InstructionBuilder builder)
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.