Package org.apache.tapestry5.plastic

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


    {
        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

        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

            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

    {
        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

        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

        map.put("alpha", validator);
        map.put("beta", validator);

        replay();

        FieldValidatorSource source = new FieldValidatorSourceImpl(messagesSource, coercer, null, map, null);

        try
        {
            source.createValidator(field, "foo", null);
            unreachable();
        }
        catch (IllegalArgumentException ex)
        {
            assertEquals(ex.getMessage(), "Unknown validator type 'foo'.  Configured validators are alpha, beta.");
View Full Code Here

        train_getValueType(validator, Object.class);
        validator.validate(field, null, formatter, inputValue);

        replay();

        FieldValidatorSource source = new FieldValidatorSourceImpl(messagesSource, coercer, fs, map, null);

        FieldValidator fieldValidator = source.createValidator(field, "required", null);

        fieldValidator.validate(inputValue);

        verify();
    }
View Full Code Here

        train_getValueType(validator, Object.class);
        validator.validate(field, null, formatter, inputValue);

        replay();

        FieldValidatorSource source = new FieldValidatorSourceImpl(messagesSource, coercer, fs, map, null);

        FieldValidator fieldValidator = source.createValidator(field, "required", null);

        fieldValidator.validate(inputValue);

        verify();
    }
View Full Code Here

        train_getValueType(validator, Object.class);
        validator.validate(field, null, formatter, inputValue);

        replay();

        FieldValidatorSource source = new FieldValidatorSourceImpl(messagesSource, coercer, fs, map, null);

        FieldValidator fieldValidator = source.createValidator(field, "required", null);

        fieldValidator.validate(inputValue);

        verify();
    }
View Full Code Here

TOP

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

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.