Package org.exolab.castor.xml.schema

Examples of org.exolab.castor.xml.schema.ContentModelGroup


            final FactoryState state) {
        //------------------------------/
        //- handle elements and groups -/
        //------------------------------/

        ContentModelGroup contentModel = model;
        Enumeration<Annotated> enumeration = contentModel.enumerate();

        //-- handle choice item
        if (new XMLInfoNature(state.getClassInfo()).isChoice()
                && state.getFieldInfoForChoice() == null) {
            state.setFieldInfoForChoice(_memberFactory.createFieldInfoForChoiceValue());
            state.getFieldInfoForChoice().getMemberAndAccessorFactory().createJavaField(
                    state.getFieldInfoForChoice(),
                    state.getJClass());
            state.getFieldInfoForChoice().getMemberAndAccessorFactory().createAccessMethods(
                    state.getFieldInfoForChoice(), state.getJClass(), getConfig().useJava50(),
                     getConfig().getAnnotationBuilders());
        }

        FieldInfo fieldInfo = null;
        XMLBindingComponent component = new XMLBindingComponent(getConfig(), getGroupNaming());
        if (_binding != null) {
            component.setBinding(_binding);
        }

        while (enumeration.hasMoreElements()) {
            Annotated annotated = enumeration.nextElement();
            component.setView(annotated);

            switch (annotated.getStructureType()) {
                case Structure.ELEMENT: //-- handle element declarations
                    fieldInfo = _memberFactory.createFieldInfo(
                            component, state, getConfig().useJava50());
                    //-- Fix for element declarations being used in
                    //-- a group with minOccurs = 0;
                    //-- (kvisco - 20021007)
                    if (contentModel.getMinOccurs() == 0) {
                        XMLInfoNature xmlNature = new XMLInfoNature(fieldInfo);
                        xmlNature.setRequired(false);
                    }

                    handleField(fieldInfo, state, component);
                    break;
                case Structure.GROUP: //-- handle groups
                    Group group = (Group) annotated;
                    //set the compositor
                    if ((contentModel instanceof ComplexType)
                            || (contentModel instanceof ModelGroup)) {
                        if (group.getOrder() == Order.choice) {
                            new XMLInfoNature(state.getClassInfo()).getGroupInfo().setAsChoice();
                        } else if (group.getOrder() == Order.all) {
                            new XMLInfoNature(state.getClassInfo()).getGroupInfo().setAsAll();
                        } else if (group.getOrder() == Order.sequence) {
                            new XMLInfoNature(state.getClassInfo()).getGroupInfo().setAsSequence();
                        }
                    }

                    //-- create class member,if necessary
                    if (!((contentModel instanceof ComplexType)
                            || (contentModel instanceof ModelGroup))) {
                        if (contentModel instanceof ModelGroup) {
                            ModelGroup mg = (ModelGroup) contentModel;
                            if (mg.isReference()) {
                                contentModel = mg.getReference();
                            }
                        }

                        if (contentModel.getParticleCount() > 0) {
                            fieldInfo = _memberFactory.createFieldInfo(
                                    component, state.getSGStateInfo(), getConfig().useJava50());
                            handleField(fieldInfo, state, component);
                        }
                    } else {
View Full Code Here


                            String refName = element.getReferenceName();
                            int count = 0;
                            int index = 0;
                            Structure structure = element.getParent();
                            if (structure instanceof ContentModelGroup) {
                                ContentModelGroup cmg = (ContentModelGroup) structure;
                                Enumeration<Structure> enumeration = cmg.enumerate();
                                while (enumeration.hasMoreElements()) {
                                    Structure tmpStruct = enumeration.nextElement();
                                    if (tmpStruct.getStructureType() == Structure.ELEMENT) {
                                        ElementDecl tmpDecl = (ElementDecl) tmpStruct;
                                        if (tmpDecl.isReference()
View Full Code Here

                            String refName = element.getReferenceName();
                            int count = 0;
                            int index = 0;
                            Structure structure = element.getParent();
                            if (structure instanceof ContentModelGroup) {
                                ContentModelGroup cmg = (ContentModelGroup)structure;
                                Enumeration enumeration = cmg.enumerate();
                                while (enumeration.hasMoreElements()) {
                                    Structure tmpStruct = (Structure)enumeration.nextElement();
                                    if (tmpStruct.getStructureType() == Structure.ELEMENT) {
                                        ElementDecl tmpDecl = (ElementDecl)tmpStruct;
                                        if (tmpDecl.isReference()) {
View Full Code Here

TOP

Related Classes of org.exolab.castor.xml.schema.ContentModelGroup

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.