} else if (item.isImplicit()) {
// implicit item uses superclass data, not a field, so just handle with map-as structure
DefinitionItem def = ((ReferenceItem)item).getDefinition();
QName qname = def.getQName();
AnnotatedBase comp = def.getSchemaComponent();
int type = comp.type();
StructureElement struct = new StructureElement();
if (type == SchemaBase.ELEMENT_TYPE) {
// reference to global element definition, just set it directly as concrete mapping reference
struct.setMapAsName(getSuperClass().getBindingName());
} else {
// set reference to abstract mapping without name, since this is an implicit reference
String uri = qname.getUri();
if (uri != null) {
holder.addTypeNameReference(uri, def.getSchemaComponent().getSchema());
}
struct.setMapAsQName(qname);
}
bindcomp.addChild(struct);
} else if (child instanceof ParentNode) {
// set up for binding generation alternatives
ParentNode subparent = (ParentNode)child;
boolean empty = subparent.getChildren().size() == 0;
boolean recurse = true;
ContainerElementBase wrapcomp = bindcomp;
StructureElementBase newcomp = null;
QName newname = null;
boolean newopt = false;
if (subparent.isCollection() && !empty) {
// always create a new <collection> element for the binding to match a collection parent node
CollectionElement collect = newCollection(wrapname, wrapopt, holder, subparent);
wrapcomp.addChild(collect);
newcomp = collect;
newname = subparent.getQName();
} else {
// check for wrapper <structure> element needed (with nested name, or multiple values, or all)
boolean all = item.getSchemaComponent().type() == SchemaBase.ALL_TYPE;
boolean multi = subparent.getChildren().size() > 1;
if ((wrapname != null && (subparent.isNamed() || multi)) || (all && multi)) {
StructureElement struct = new StructureElement();
struct.setOrdered(!all);
setName(wrapname, holder, struct);
if (wrapopt) {
struct.setUsage(PropertyAttributes.OPTIONAL_USAGE);
}
wrapcomp.addChild(struct);
wrapcomp = struct;
if (!empty && bindcomp.type() == ElementBase.COLLECTION_ELEMENT &&
getSchemaCustom().getRepeatType() != SchemaRootBase.REPEAT_ARRAY) {
// dig into child node(s) to find the item type
DataNode nested = subparent;
String type = null;
while (((ParentNode)nested).getChildren().size() > 0) {
nested = (DataNode)((ParentNode)nested).getChildren().get(0);
if (nested.isCollection() || nested instanceof LeafNode) {
type = nested.getBindingType();
break;
}
}
struct.setDeclaredType(type);
}
} else {
newname = wrapname;
newopt = wrapopt;
}
// check for name associated with this node
if (subparent.isNamed()) {
// check if this is an attribute
AnnotatedBase comp = item.getSchemaComponent();
if (comp.type() == SchemaBase.ATTRIBUTE_TYPE) {
// handle attribute with embedded definition
ValueElement value = new ValueElement();
value.setEffectiveStyle(NestingAttributes.ATTRIBUTE_STYLE);
setName(subparent.getQName(), holder, value);