Package org.apache.commons.betwixt.expression

Examples of org.apache.commons.betwixt.expression.Expression.evaluate()


                            if(idExpression == null) {
                                   throw new IntrospectionException(
                                         "The specified id property wasn't found in the bean ("
                                        + idAttribute + ").");
                            }
                            Object exp = idExpression.evaluate( context );
                            if (exp == null) {
                                // we'll use a random id
                                log.debug("Using random id");
                                id = idGenerator.nextId();
                               
View Full Code Here


                    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
View Full Code Here

                } else {
                    // Mixed text content
                    // evaluate the body text
                    Expression expression = childDescriptors[i].getTextExpression();
                    if ( expression != null ) {
                        Object value = expression.evaluate( context );
                        String text = convertToString(
                                                        value,
                                                        childDescriptors[i],
                                                        context );
                        if ( text != null && text.length() > 0 ) {;
View Full Code Here

            }
        } else {
            // evaluate the body text
            Expression expression = elementDescriptor.getTextExpression();
            if ( expression != null ) {
                Object value = expression.evaluate( context );
                String text = convertToString( value, elementDescriptor, context );
                if ( text != null && text.length() > 0 ) {
                    bodyText( writeContext, text );
                }
            }
View Full Code Here

        }
       
        // an element is not empty if it has a non-empty body
        Expression expression = descriptor.getTextExpression();
        if ( expression != null ) {
            Object value = expression.evaluate( context );
            String text = convertToString( value, descriptor, context );
            if ( text != null && text.length() > 0 ) {
                log.trace( "Element has body text which isn't empty." );
                return false;
            }
View Full Code Here

       
        if ( descriptor.isHollow() )
        {
            Expression contentExpression = descriptor.getContextExpression();
            if (contentExpression != null) {
                Object childBean = contentExpression.evaluate(context);
                if (childBean != null)
                {
                    XMLBeanInfo xmlBeanInfo = findXMLBeanInfo(childBean, descriptor);
                    Object currentBean = context.getBean();
                    context.setBean(childBean);
View Full Code Here

                        Context context )
                            throws
                                IOException, SAXException {
        Expression expression = attributeDescriptor.getTextExpression();
        if ( expression != null ) {
            Object value = expression.evaluate( context );
            if ( value != null ) {
                String text = value.toString();
                if ( text != null && text.length() > 0 ) {
                    expressAttribute(
                                    attributeDescriptor.getURI(),
View Full Code Here

        }
       
        private String valueAttribute(AttributeDescriptor attribute) {
            Expression expression = attribute.getTextExpression();
            if ( expression != null ) {
                Object value = expression.evaluate( context );
                return convertToString( value, attribute, context );
            }
           
            return "";
        }
View Full Code Here

                    // 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();
                            String namespaceUri = childDescriptor.getURI();
                            String localName = childDescriptor.getLocalName();
                            // XXXX: should we handle nulls better
View Full Code Here

                } else {
                    // Mixed text content
                    // evaluate the body text
                    Expression expression = childDescriptors[i].getTextExpression();
                    if ( expression != null ) {
                        Object value = expression.evaluate( context );
                        String text = convertToString(
                                                        value,
                                                        childDescriptors[i],
                                                        context );
                        if ( text != null && text.length() > 0 ) {;
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.