Examples of PlasticField


Examples of org.apache.tapestry5.plastic.PlasticField

        return proxyFactory.createProxy(interfaceType, new PlasticClassTransformer()
        {
            @Override
            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);
                        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()
                    {
                        @Override
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

        ClassInstantiator instantiator = proxyFactory.createProxy(interfaceType, new PlasticClassTransformer()
        {
            @Override
            public void transform(PlasticClass plasticClass)
            {
                final PlasticField registryField = plasticClass.introduceField(StrategyRegistry.class, "registry")
                        .inject(registry);

                for (final Method method : interfaceType.getMethods())
                {
                    plasticClass.introduceMethod(new MethodDescription(method), new InstructionBuilderCallback()
View Full Code Here

Examples of org.apache.tapestry5.plastic.PlasticField

        ClassInstantiator<T> instantiator = proxyFactory.createProxy(commandInterface, new PlasticClassTransformer()
        {
            @Override
            public void transform(PlasticClass plasticClass)
            {
                PlasticField commandsField = plasticClass.introduceField(commandsArray.getClass(), "commands").inject(
                        commandsArray);

                for (Method method : commandInterface.getMethods())
                {
                    implementMethod(plasticClass, method, commandsField);
View Full Code Here

Examples of org.apache.tapestry5.plastic.PlasticField

        if (paths.length == 0)
            return;

        String[] expandedPaths = expandPaths(paths);

        PlasticField assetListField = componentClass.introduceField(Asset[].class,
                "importedAssets_" + method.getDescription().methodName);

        initializeAssetsFromPaths(componentClass, model.getBaseResource(), expandedPaths, assetListField);

        addMethodAssetOperationAdvice(method, assetListField.getHandle(), operation);
    }
View Full Code Here

Examples of org.apache.tapestry5.plastic.PlasticField

    private void implementComponentInterface(PlasticClass plasticClass)
    {
        plasticClass.introduceInterface(Component.class);

        final PlasticField resourcesField = plasticClass.introduceField(InternalComponentResources.class,
                "internalComponentResources").injectFromInstanceContext();

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

Examples of org.apache.tapestry5.plastic.PlasticField

    public TransformField createField(int modifiers, String type, String suggestedName)
    {
        // TODO: modifiers are ignored

        PlasticField newField = plasticClass.introduceField(type, suggestedName);

        return toTransformField(newField);
    }
View Full Code Here

Examples of org.apache.tapestry5.plastic.PlasticField

    public String addInjectedField(Class type, String suggestedName, Object value)
    {
        // TODO: The injected field is not actually protected or shared

        PlasticField field = plasticClass.introduceField(type, suggestedName).inject(value);

        return field.getName();
    }
View Full Code Here

Examples of org.apache.tapestry5.plastic.PlasticField

    public <T> TransformField addIndirectInjectedField(Class<T> type, String suggestedName,
            ComponentValueProvider<T> provider)
    {

        PlasticField field = plasticClass.introduceField(type, suggestedName).injectComputed(toComputedValue(provider));

        return toTransformField(field);
    }
View Full Code Here

Examples of org.apache.tapestry5.plastic.PlasticField

         * was introduced through this instance of BridgeClassTransformation.
         */
        public void replaceAccess(TransformField conduitField)
        {
            // Ugly:
            PlasticField conduitFieldPlastic = ((BridgeTransformField) conduitField).plasticField;

            final FieldHandle conduitHandle = conduitFieldPlastic.getHandle();

            plasticField.setConduit(new WrapFieldHandleForFieldValueConduitAsFieldConduit(conduitHandle));
        }
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.