Package org.apache.commons.betwixt.expression

Examples of org.apache.commons.betwixt.expression.Context


            // process child elements
            for ( int i = 0, size = childDescriptors.length; i < size; i++ ) {
                if (childDescriptors[i] instanceof ElementDescriptor) {
                    // Element content
                    ElementDescriptor childDescriptor = (ElementDescriptor) childDescriptors[i];
                    Context childContext = context;
                    childContext.pushOptions(childDescriptor.getOptions());
                    Expression childExpression = childDescriptor.getContextExpression();
                    if ( childExpression != null ) {
                        Object childBean = childExpression.evaluate( context );
                        if ( childBean != null ) {
                            String qualifiedName = childDescriptor.getQualifiedName();
                            String namespaceUri = childDescriptor.getURI();
                            String localName = childDescriptor.getLocalName();
                            // XXXX: should we handle nulls better
                            if ( childBean instanceof Iterator ) {
                                for ( Iterator iter = (Iterator) childBean; iter.hasNext(); ) {
                                    Object object = iter.next();
                                    if (object == null) {
                                        continue;
                                    }
                                    writeBean(
                                            namespaceUri,
                                            localName,
                                            qualifiedName,
                                            object,
                                            childDescriptor,
                                            context );
                                }
                            } else {
                                writeBean(
                                            namespaceUri,
                                            localName,
                                            qualifiedName,
                                            childBean,
                                            childDescriptor,
                                            context );
                            }
                        }                   
                    } else {
                        writeElement(
                                    childDescriptor.getURI(),
                                    childDescriptor.getLocalName(),
                                    childDescriptor.getQualifiedName(),
                                    childDescriptor,
                                    childContext );
                    }
                    childContext.popOptions();
                } else {
                    // Mixed text content
                    // evaluate the body text
                    Expression expression = childDescriptors[i].getTextExpression();
                    if ( expression != null ) {
View Full Code Here


      * Ensure that they are correctly configured.
      * @param bean make a new Context for this bean
      * @return not null
      */
    private Context makeContext(Object bean) {
        return new Context( bean, log, bindingConfiguration );
    }
View Full Code Here

                            String pathPrefix,
                            boolean matchIDs ) {
        this(
                descriptor,
                beanClass,
                new Context(),
                pathPrefix,
                matchIDs);
    }
View Full Code Here

            // process child elements
            for ( int i = 0, size = childDescriptors.length; i < size; i++ ) {
                if (childDescriptors[i] instanceof ElementDescriptor) {
                    // Element content
                    ElementDescriptor childDescriptor = (ElementDescriptor) childDescriptors[i];
                    Context childContext = context;
                    Expression childExpression = childDescriptor.getContextExpression();
                    if ( childExpression != null ) {
                        Object childBean = childExpression.evaluate( context );
                        if ( childBean != null ) {
                            String qualifiedName = childDescriptor.getQualifiedName();
View Full Code Here

      * Ensure that they are correctly configured.
      * @param bean make a new Context for this bean
      * @return not null
      */
    private Context makeContext(Object bean) {
        return new Context( bean, log, bindingConfiguration );
    }
View Full Code Here

                            String pathPrefix,
                            boolean matchIDs ) {
        this(
                descriptor,
                beanClass,
                new Context(),
                pathPrefix,
                matchIDs);
    }
View Full Code Here

               
                if ( log.isTraceEnabled() ) {
                    log.trace("Body with text " + text);
                }
                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() ) {
View Full Code Here

                            String pathPrefix,
                            boolean matchIDs ) {
        this(
                descriptor,
                beanClass,
                new Context(),
                pathPrefix,
                matchIDs);
    }
View Full Code Here

            // process child elements
            for ( int i = 0, size = childDescriptors.length; i < size; i++ ) {
                if (childDescriptors[i] instanceof ElementDescriptor) {
                    // Element content
                    ElementDescriptor childDescriptor = (ElementDescriptor) childDescriptors[i];
                    Context childContext = context;
                    Expression childExpression = childDescriptor.getContextExpression();
                    if ( childExpression != null ) {
                        Object childBean = childExpression.evaluate( context );
                        if ( childBean != null ) {
                            String qualifiedName = childDescriptor.getQualifiedName();
View Full Code Here

      * Ensure that they are correctly configured.
      * @param bean make a new Context for this bean
      * @return not null
      */
    private Context makeContext(Object bean) {
        return new Context( bean, log, bindingConfiguration );
    }
View Full Code Here

TOP

Related Classes of org.apache.commons.betwixt.expression.Context

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.