* @param typemap map from type qualified name to class data
*/
private static void accumulateBindingDefinitions(BindingElement binding, Map elemmap, Map typemap) {
ArrayList childs = binding.topChildren();
for (int i = 0; i < childs.size(); i++) {
ElementBase element = (ElementBase)childs.get(i);
if (element.type() == ElementBase.INCLUDE_ELEMENT) {
// use recursive call to add nested definitions in included binding
BindingElement inclbinding = ((org.jibx.binding.model.IncludeElement)element).getBinding();
if (inclbinding != null) {
accumulateBindingDefinitions(inclbinding, elemmap,
typemap);
}
} else if (element.type() == ElementBase.MAPPING_ELEMENT) {
// handle mapping as type if abstract with type name, or as element if concrete
MappingElementBase mapping = (MappingElementBase)element;
String cname = mapping.getClassName();
TypeData data = buildClassData(cname, false);
if (mapping.isAbstract()) {
QName qname = mapping.getTypeQName();
if (qname != null) {
typemap.put(qname, data);
if (s_logger.isDebugEnabled()) {
s_logger.debug("Added class " + cname + " for type " + qname);
}
}
} else {
QName qname = new QName(mapping.getNamespace().getUri(), mapping.getName());
elemmap.put(qname, data);
if (s_logger.isDebugEnabled()) {
s_logger.debug("Added class " + cname + " for element " + qname);
}
}
} else if (element.type() == ElementBase.FORMAT_ELEMENT) {
// add named format as simple type definition
FormatElement format = (FormatElement)element;
String name = format.getTypeName();
if (name != null) {