List<Class> classes = getSortedClasses(set.beans().keySet());
Map<Class, ? extends RuntimeClassInfo> beans = set.beans();
for (Class cls : classes) {
JType jt = getType(cls);
ElementWriterBuilder instcWriter = rootWriter.newCondition(rootWriter.getObject()._instanceof(jt), jt);
RuntimeClassInfo rci = beans.get(cls);
add(instcWriter, cls, rci);
instcWriter.getCurrentBlock()._return();
if (!beans.get(cls).isElement()) {
c2type.put(cls, rci.getTypeName());
}
}
Map<QName, ? extends RuntimeElementInfo> elementMappings = set.getElementMappings(null);
for (Map.Entry<QName, ? extends RuntimeElementInfo> e : elementMappings.entrySet()) {
QName q = e.getKey();
RuntimeElementInfo rei = e.getValue();
Class<?> c = (Class<?>) rei.getContentType().getType();
JType jt = model._ref(c);
ElementWriterBuilder instcWriter =
rootWriter.newCondition(rootWriter.getObject()._instanceof(jt), jt);
if (rei.getContentType().isSimpleType()) {
writeSimpleTypeElement(instcWriter, rei.getContentType(), null, true, c, c, jt);
} else {
add(rootWriter, c, (RuntimeClassInfo) rei.getContentType());
}
c2type.put(c, q);
}
for (Map.Entry<Class, ? extends RuntimeEnumLeafInfo> e : set.enums().entrySet()) {
Class c = e.getKey();
RuntimeEnumLeafInfo info = e.getValue();
JType jt = model._ref(c);
ElementWriterBuilder instcWriter =
rootWriter.newCondition(rootWriter.getObject()._instanceof(jt), jt);
writeSimpleTypeElement(instcWriter, info, null, true, c, c, jt);
if (!info.isElement()) {
c2type.put(c, info.getTypeName());