Examples of PlasticField


Examples of org.apache.tapestry5.plastic.PlasticField

    }

    private void transformMethod(final PlasticClass plasticClass, final PlasticMethod method) {

        final PlasticField tokenFieldInstance = plasticClass.introduceField(InterceptorStatusToken.class,"_$token");
        final FieldHandle tokenFieldHandle = tokenFieldInstance.getHandle();
       
       
        // Attribute definition
        final Secured annotation = method.getAnnotation(Secured.class);
        //final String configField = createConfigAttributeDefinitionField(transformation, annotation);
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

        ClassInstantiator instantiator = proxyFactory.createProxy(propertyType, new PlasticClassTransformer()
        {
            public void transform(PlasticClass plasticClass)
            {
                final PlasticField sourceField = plasticClass.introduceField(sourceClass, "source").inject(source);

                PlasticMethod delegateMethod = plasticClass.introducePrivateMethod(propertyType.getName(),
                        "readProperty", null, null);

                // You don't do this using MethodAdvice, because then we'd have to use reflection to access the read
View Full Code Here

Examples of org.apache.tapestry5.plastic.PlasticField

    {
        instantiator = proxyFactory.createProxy(serviceInterface, new PlasticClassTransformer()
        {
            public void transform(PlasticClass plasticClass)
            {
                PlasticField filterField = plasticClass.introduceField(filterInterface, "filter")
                        .injectFromInstanceContext();
                PlasticField nextField = plasticClass.introduceField(serviceInterface, "next")
                        .injectFromInstanceContext();

                processMethods(plasticClass, filterField, nextField);

                plasticClass.addToString(String.format("<PipelineBridge from %s to %s>", serviceInterface.getName(),
View Full Code Here

Examples of org.apache.tapestry5.plastic.PlasticField

        plasticClass.addToString(description);

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

        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()
        {
            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()
        {
            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

            return;
        }

        plasticClass.introduceInterface(RenderCommand.class);

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

        plasticClass.introduceMethod(RENDER_DESCRIPTION).delegateTo(resourcesField);

        plasticClass.introduceMethod(TransformConstants.POST_RENDER_CLEANUP_DESCRIPTION).delegateTo(resourcesField);
    }
View Full Code Here

Examples of org.apache.tapestry5.plastic.PlasticField

    {
        List<PlasticField> sortedFields = CollectionFactory.newList(fields);
        Collections.sort(sortedFields, INDEX_COMPARATOR);
        validateSortedFields(sortedFields);

        PlasticField firstField = sortedFields.get(0);
        PageActivationContext firstAnnotation = firstField.getAnnotation(PageActivationContext.class);

        // these arrays reduce memory usage and allow the PlasticField instances to be garbage collected
        FieldHandle[] handles = new FieldHandle[sortedFields.size()];
        String[] typeNames = new String[sortedFields.size()];
View Full Code Here

Examples of org.apache.tapestry5.plastic.PlasticField

        List<Integer> actualIndexes = CollectionFactory.newList();
        Set<Boolean> activates = CollectionFactory.newSet();
        Set<Boolean> passivates = CollectionFactory.newSet();

        for (int i = 0; i < sortedFields.size(); ++i) {
            PlasticField field = sortedFields.get(i);
            PageActivationContext annotation = field.getAnnotation(PageActivationContext.class);
            expectedIndexes.add(i);
            actualIndexes.add(annotation.index());
            activates.add(annotation.activate());
            passivates.add(annotation.passivate());
        }
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.