CollectionElement coll = new CollectionElement(); if (memb.getFieldName() == null) { coll.setGetName(gmeth); coll.setSetName(memb.getSetName()); } else { coll.setFieldName(memb.getFieldName()); coll.setName(name); hold.addNamespaceUsage(hold.getNamespace()); coll.setUsageName("optional"); 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());
/** * Create a new <b>collection</b> element for the binding. This initializes the create and declared types of the * collection as appropriate, along with the wrapper name and optional status. * * @param wrapname name to be used for wrapper collection or structure, <code>null</code> if none * @param wrapopt wrapper element optional flag (should be <code>false</code> if wrapname is <code>null</code>) * @param holder binding definition tracking information * @param node data node associated with collection * @return collection element */ private CollectionElement newCollection(QName wrapname, boolean wrapopt, BindingHolder holder, DataNode node) { CollectionElement collect = new CollectionElement(); int reptype = getSchemaCustom().getRepeatType(); boolean list = reptype == SchemaRootBase.REPEAT_LIST || reptype == SchemaRootBase.REPEAT_TYPED; if (list) { collect.setCreateType(m_listImplClass); } if (wrapname == null) { if (node.isOptional()) { collect.setUsage(PropertyAttributes.OPTIONAL_USAGE); } } else { setName(wrapname, holder, collect); if (wrapopt) { collect.setUsage(PropertyAttributes.OPTIONAL_USAGE); } } return collect; }
(StructureElementBase)new CollectionElement() : (StructureElementBase)new StructureElement(); String mapper; switch (anytype) { collect.setGetName(gname); collect.setSetName(sname); if (parent.isSelectorNeeded()) { collect.setUsage(PropertyAttributes.OPTIONAL_USAGE); collect.setTestName("if" + leaf.getSelectPropName()); collect.setCreateType(m_listImplClass); if (gname == null) { collect.setDeclaredType(COLLECTION_VARIABLE_TYPE); collect.setItemTypeName(defclas.getBindingName()); setName(leaf.getQName(), holder, struct); collect.addChild(struct); collect.addChild(struct); collect.addChild(value);
} else if (comp instanceof CollectionElement) { CollectionElement coll = (CollectionElement)comp; if (coll.children().size() > 0) { if (coll.isOrdered()) { String itype = coll.getItemTypeName(); TemplateElementBase ref = coll.getDefinitions().getSpecificTemplate(itype); if (ref instanceof MappingElement) {
struct.setCreateType(custom.getCreateType()); struct.setFactoryName(custom.getFactoryMethod()); coll.addChild(struct); coll.setItemTypeName(itype); coll.setItemTypeName(itype); value.setName(iname); value.setDeclaredType(itype); coll.addChild(value); if (custom != null) { value.setDefaultText(custom.getEnumValueMethod()); hold.addNamespaceUsage(hold.getNamespace()); fillStructure(custom, null, null, struct, hold); coll.addChild(struct);
IClass itype = collect.getItemTypeClass(); if (isEnumeration(itype)) { TemplateElementBase ref = collect.getDefinitions().getSpecificTemplate(type); if (ref instanceof MappingElement) { MappingElement mapref = (MappingElement)ref;
String itype = coll.getItemTypeName(); TemplateElementBase ref = coll.getDefinitions().getSpecificTemplate(itype); if (ref instanceof MappingElement) {
CollectionElement coll = new CollectionElement(); m_bindingGenerator.defineCollection(itype, value.getItemName(), coll, bind); mapping.addChild(coll);