Examples of CollectionElement


Examples of org.jibx.binding.model.CollectionElement

                    addCompositorPart(part, cdef);
                   
                } else if (iscoll) {
                   
                    // collection without a wrapper element
                    CollectionElement coll = (CollectionElement)comp;
                    String itype = coll.getItemTypeName();
                    TemplateElementBase ref = coll.getDefinitions().getSpecificTemplate(itype);
                    if (ref instanceof MappingElement) {
                       
                        // item type with concrete mapping, make it an element
                        MappingDetail detail = m_detailDirectory.getMappingDetail((MappingElementBase)ref);
                        ElementElement item = new ElementElement();
View Full Code Here

Examples of org.jibx.binding.model.CollectionElement

           
            // check for repeated item
            if (memb.isCollection()) {
               
                // create collection element for field or property
                CollectionElement coll = new CollectionElement();
                if (memb.getFieldName() == null) {
                    coll.setGetName(gmeth);
                    coll.setSetName(memb.getSetName());
                } else {
                    coll.setFieldName(memb.getFieldName());
                }
                setTypes(memb, coll);
               
                // set the element name, if defined
                String name = memb.getXmlName();
                if ((cust.isWrapCollections() || memb.isElementForced()) && name != null) {
                    coll.setName(name);
                    hold.addNamespaceUsage(hold.getNamespace());
                }
               
                // check for optional value
                if (!memb.isRequired()) {
                    coll.setUsageName("optional");
                }
               
                // check for type defined
                String itype = memb.getItemType();
                if (itype != null) {
                   
                    // set name to be used for items in collection
                    String iname = memb.getItemName();
                    if (iname == null) {
                       
                        // use name based on item type
                        String simple = itype;
                        int split = simple.lastIndexOf('.');
                        if (split >= 0) {
                            simple = simple.substring(0, split);
                        }
                        iname = cust.convertName(simple);
                       
                    }
                   
                    // define the collection details
                    defineCollection(itype, iname, coll, hold);
                   
                    // check for special case of two unwrapped collections with same item-type and no children
                    ArrayList siblings = parent.children();
                    if (siblings.size() > 0 && coll.children().size() == 0 && coll.getName() == null) {
                        ElementBase sibling = (ElementBase)siblings.get(siblings.size()-1);
                        if (sibling.type() == ElementBase.COLLECTION_ELEMENT) {
                            CollectionElement lastcoll = (CollectionElement)sibling;
                            if (lastcoll.children().size() == 0 && lastcoll.getName() == null &&
                                Utility.safeEquals(lastcoll.getItemTypeName(), coll.getItemTypeName())) {
                                throw new IllegalStateException("Need to use wrapper element for collection member '" +
                                    memb.getBaseName() + "' of class " + cust.getName());
                            }
                        }
                    }
View Full Code Here

Examples of org.jibx.binding.model.CollectionElement

            (NestingElementBase)m_structureStack.peek(0);
        boolean only = parent.children().size() == 1;
        if (comp.type() == ElementBase.COLLECTION_ELEMENT) {
           
            // collection may define type or not
            CollectionElement collection = (CollectionElement)comp;
            String itype = collection.getItemTypeClass().getName();
            DefinitionContext dctx = getDefinitions();
            TemplateElementBase templ = dctx.getSpecificTemplate(itype);
            Element element = null;
            if (! (templ instanceof MappingElement)) {
                if (only) {
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.