Package org.jibx.schema

Examples of org.jibx.schema.IArity


        m_global = global == null ? (GlobalExtension)this : global;
        if (comp instanceof IArity) {
           
            // element can only be optional or repeated when embedded, but no need to check since counts are forbidden
            //  on a global definition
            IArity particle = (IArity)comp;
            m_repeated = SchemaUtils.isRepeated(particle);
            if (comp.type() == SchemaBase.ELEMENT_TYPE) {
                m_optional = SchemaUtils.isOptionalElement((ElementElement)comp);
            } else {
                m_optional = SchemaUtils.isOptional(particle);
View Full Code Here


                           
                        } else if (size == 1) {
                           
                            // single component in compositor, first try to convert compositor to singleton
                            OpenAttrBase grandchild = (OpenAttrBase)compositor.getParticleList().get(0);
                            IArity particle = (IArity)grandchild;
                            if (SchemaUtils.isRepeated(compositor)) {
                                if (!SchemaUtils.isRepeated(particle)) {
                                   
                                    // repeated compositor with non-repeated particle, so pass repeat to particle
                                    if (s_logger.isDebugEnabled()) {
                                        s_logger.debug(lead + "passing repeat from compositor " +
                                            SchemaUtils.componentPath(childcomp) + " to only child " +
                                            SchemaUtils.describeComponent(grandchild));
                                    }
                                    particle.setMaxOccurs(compositor.getMaxOccurs());
                                    ((ComponentExtension)grandchild.getExtension()).setRepeated(true);
                                    compositor.setMaxOccurs(null);
                                    ((ComponentExtension)compositor.getExtension()).setRepeated(false);
                                   
                                } else if ((compositor.getMaxOccurs().isUnbounded() &&
                                    particle.getMaxOccurs().isUnbounded())) {
                                   
                                    // unbounded compositor with unbounded particle, just wipe repeat from compositor
                                    if (s_logger.isDebugEnabled()) {
                                        s_logger.debug(lead + "clearing unbounded from compositor " +
                                            SchemaUtils.componentPath(childcomp) + " with unbounded only child " +
                                            SchemaUtils.describeComponent(grandchild));
                                    }
                                    compositor.setMaxOccurs(null);
                                    ((ComponentExtension)compositor.getExtension()).setRepeated(false);
                                   
                                }
                            }
                            if (SchemaUtils.isOptional(compositor)) {
                                if (SchemaUtils.isOptional(particle)) {
                                   
                                    // optional compositor with optional particle, just wipe optional from compositor
                                    if (s_logger.isDebugEnabled()) {
                                        s_logger.debug(lead + "clearing optional from compositor " +
                                            SchemaUtils.componentPath(childcomp) + " with optional only child " +
                                            SchemaUtils.describeComponent(grandchild));
                                    }
                                    compositor.setMinOccurs(null);
                                    ((ComponentExtension)compositor.getExtension()).setOptional(false);
                                   
                                } else if (Count.isCountEqual(1, particle.getMinOccurs())) {
                                   
                                    // optional compositor with required particle, so pass optional to particle
                                    if (s_logger.isDebugEnabled()) {
                                        s_logger.debug(lead + "passing optional from compositor " +
                                            SchemaUtils.componentPath(childcomp) + " to required only child " +
                                            SchemaUtils.describeComponent(grandchild));
                                    }
                                    particle.setMinOccurs(Count.COUNT_ZERO);
                                    ((ComponentExtension)grandchild.getExtension()).setOptional(true);
                                    compositor.setMinOccurs(null);
                                    ((ComponentExtension)compositor.getExtension()).setOptional(false);
                                   
                                }
View Full Code Here

TOP

Related Classes of org.jibx.schema.IArity

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.