Package org.apache.commons.betwixt

Examples of org.apache.commons.betwixt.TextDescriptor


        if (currentDescriptor == null) {
            if (log.isTraceEnabled()) {
                log.trace("path descriptor is null:");
            }
        } else {
            TextDescriptor bodyTextdescriptor =
                currentDescriptor.getPrimaryBodyTextDescriptor();
            if (bodyTextdescriptor != null) {
                if (log.isTraceEnabled()) {
                    log.trace("Setting mixed content for:");
                    log.trace(bodyTextdescriptor);
                }
                Updater updater = bodyTextdescriptor.getUpdater();
                if (log.isTraceEnabled())
                {   
                    log.trace("Updating mixed content with:");
                    log.trace(updater);
                }
View Full Code Here


     * 2. If this tag has a value attribute together with either a property
     * or type attribute.
     */
    public void begin(String name, String namespace, Attributes attributes) throws SAXException {
       
        TextDescriptor descriptor = new TextDescriptor();
       
        String value = attributes.getValue( "value" );
        String propertyName = attributes.getValue( "property" );
        String propertyType = attributes.getValue( "type" );
       
        if ( value != null) {
            if ( propertyName != null || propertyType != null ) {
                // not allowed
                throw new SAXException(
                    "You cannot specify attribute 'value' together with either "
                    + " the 'property' or 'type' attributes");               
            }
            // fixed value text
            descriptor.setTextExpression( new ConstantExpression( value ) );
           
        } else {
            // property based text
            descriptor.setPropertyName( propertyName );
           
            Class beanClass = getBeanClass();
           
            // set the property type using reflection
            descriptor.setPropertyType(
                getPropertyType( propertyType, beanClass, propertyName )
            );
           
            if ( beanClass != null ) {
                String descriptorPropertyName = descriptor.getPropertyName();
                PropertyDescriptor propertyDescriptor =
                    getPropertyDescriptor( beanClass, descriptorPropertyName );
                if ( propertyDescriptor != null ) {
                        Method readMethod = propertyDescriptor.getReadMethod();
                        descriptor.setTextExpression( new MethodExpression( readMethod ) );
                        Method writeMethod = propertyDescriptor.getWriteMethod();
                        if (writeMethod != null) {
                            descriptor.setUpdater( new MethodUpdater(writeMethod));
                        }
                        getProcessedPropertyNameSet().add( descriptorPropertyName );
                }
            }
        }
View Full Code Here

                }
                if ( digester.getCount() > 0 ) {
                    Context bodyContext = context.newContext( digester.peek() );
                    // Take the first content descriptor
                    ElementDescriptor typeDescriptor = getElementDescriptor( descriptor );
                    TextDescriptor descriptor = typeDescriptor.getPrimaryBodyTextDescriptor();
                    if ( descriptor != null ) {
                        if ( log.isTraceEnabled() ) {
                            log.trace("Setting mixed content for:");
                            log.trace(descriptor);
                        }
                        Updater updater = descriptor.getUpdater();
                        if ( log.isTraceEnabled() ) {
                            log.trace( "Updating mixed content with:" );
                            log.trace( updater );
                        }
                        if ( updater != null && text != null ) {
View Full Code Here

     * 2. If this tag has a value attribute together with either a property
     * or type attribute.
     */
    public void begin(Attributes attributes) throws SAXException {
       
        TextDescriptor descriptor = new TextDescriptor();
       
        String value = attributes.getValue( "value" );
        String propertyName = attributes.getValue( "property" );
        String propertyType = attributes.getValue( "type" );
       
        if ( value != null) {
            if ( propertyName != null || propertyType != null ) {
                // not allowed
                throw new SAXException(
                    "You cannot specify attribute 'value' together with either "
                    + " the 'property' or 'type' attributes");               
            }
            // fixed value text
            descriptor.setTextExpression( new ConstantExpression( value ) );
           
        } else {
            // property based text
            descriptor.setPropertyName( propertyName );
           
            Class beanClass = getBeanClass();
           
            // set the property type using reflection
            descriptor.setPropertyType(
                getPropertyType( propertyType, beanClass, propertyName )
            );
           
            if ( beanClass != null ) {
                String name = descriptor.getPropertyName();
                PropertyDescriptor propertyDescriptor =
                    getPropertyDescriptor( beanClass, name );
                if ( propertyDescriptor != null ) {
                        Method readMethod = propertyDescriptor.getReadMethod();
                        descriptor.setTextExpression( new MethodExpression( readMethod ) );
                        Method writeMethod = propertyDescriptor.getWriteMethod();
                        if (writeMethod != null) {
                            descriptor.setUpdater( new MethodUpdater(writeMethod));
                        }
                        getProcessedPropertyNameSet().add( name );
                }
            }
        }
View Full Code Here

     * 2. If this tag has a value attribute together with either a property
     * or type attribute.
     */
    public void begin(String name, String namespace, Attributes attributes) throws SAXException {
       
        TextDescriptor descriptor = new TextDescriptor();
       
        String value = attributes.getValue( "value" );
        String propertyName = attributes.getValue( "property" );
        String propertyType = attributes.getValue( "type" );
       
        if ( value != null) {
            if ( propertyName != null || propertyType != null ) {
                // not allowed
                throw new SAXException(
                    "You cannot specify attribute 'value' together with either "
                    + " the 'property' or 'type' attributes");               
            }
            // fixed value text
            descriptor.setTextExpression( new ConstantExpression( value ) );
           
        } else {
            // property based text
            descriptor.setPropertyName( propertyName );
           
            Class beanClass = getBeanClass();
           
            // set the property type using reflection
            descriptor.setPropertyType(
                getPropertyType( propertyType, beanClass, propertyName )
            );
           
            if ( beanClass != null ) {
                String descriptorPropertyName = descriptor.getPropertyName();
                PropertyDescriptor propertyDescriptor =
                    getPropertyDescriptor( beanClass, descriptorPropertyName );
                if ( propertyDescriptor != null ) {
                        Method readMethod = propertyDescriptor.getReadMethod();
                        descriptor.setTextExpression( new MethodExpression( readMethod ) );
                        Method writeMethod = propertyDescriptor.getWriteMethod();
                        if (writeMethod != null) {
                            descriptor.setUpdater( new MethodUpdater(writeMethod));
                        }
                        getProcessedPropertyNameSet().add( descriptorPropertyName );
                }
            }
        }
View Full Code Here

        if (currentDescriptor == null) {
            if (log.isTraceEnabled()) {
                log.trace("path descriptor is null:");
            }
        } else {
            TextDescriptor bodyTextdescriptor =
                currentDescriptor.getPrimaryBodyTextDescriptor();
            if (bodyTextdescriptor != null) {
                if (log.isTraceEnabled()) {
                    log.trace("Setting mixed content for:");
                    log.trace(bodyTextdescriptor);
                }
                Updater updater = bodyTextdescriptor.getUpdater();
                if (log.isTraceEnabled())
                {   
                    log.trace("Updating mixed content with:");
                    log.trace(updater);
                }
View Full Code Here

     * 2. If this tag has a value attribute together with either a property
     * or type attribute.
     */
    public void begin(String name, String namespace, Attributes attributes) throws SAXException {
       
        TextDescriptor descriptor = new TextDescriptor();
       
        String value = attributes.getValue( "value" );
        String propertyName = attributes.getValue( "property" );
        String propertyType = attributes.getValue( "type" );
       
        if ( value != null) {
            if ( propertyName != null || propertyType != null ) {
                // not allowed
                throw new SAXException(
                    "You cannot specify attribute 'value' together with either "
                    + " the 'property' or 'type' attributes");               
            }
            // fixed value text
            descriptor.setTextExpression( new ConstantExpression( value ) );
           
        } else {
            // property based text
            descriptor.setPropertyName( propertyName );
           
            Class beanClass = getBeanClass();
           
            // set the property type using reflection
            descriptor.setPropertyType(
                getPropertyType( propertyType, beanClass, propertyName )
            );
           
            if ( beanClass != null ) {
                String descriptorPropertyName = descriptor.getPropertyName();
                PropertyDescriptor propertyDescriptor =
                    getPropertyDescriptor( beanClass, descriptorPropertyName );
                if ( propertyDescriptor != null ) {
                        Method readMethod = propertyDescriptor.getReadMethod();
                        descriptor.setTextExpression( new MethodExpression( readMethod ) );
                        Method writeMethod = propertyDescriptor.getWriteMethod();
                        if (writeMethod != null) {
                            descriptor.setUpdater( new MethodUpdater(writeMethod));
                        }
                        getProcessedPropertyNameSet().add( descriptorPropertyName );
                }
            }
        }
View Full Code Here

        if (currentDescriptor == null) {
            if (log.isTraceEnabled()) {
                log.trace("path descriptor is null:");
            }
        } else {
            TextDescriptor bodyTextdescriptor =
                currentDescriptor.getPrimaryBodyTextDescriptor();
            if (bodyTextdescriptor != null) {
                if (log.isTraceEnabled()) {
                    log.trace("Setting mixed content for:");
                    log.trace(bodyTextdescriptor);
                }
                Updater updater = bodyTextdescriptor.getUpdater();
                if (log.isTraceEnabled())
                {   
                    log.trace("Updating mixed content with:");
                    log.trace(updater);
                }
View Full Code Here

TOP

Related Classes of org.apache.commons.betwixt.TextDescriptor

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.