public void createElementsForTypeMappingInfo() {
if (this.javaClassToTypeMappingInfos != null && !this.javaClassToTypeMappingInfos.isEmpty()) {
Set<JavaClass> classes = this.javaClassToTypeMappingInfos.keySet();
for (JavaClass nextClass : classes) {
TypeMappingInfo nextInfo = this.javaClassToTypeMappingInfos.get(nextClass);
if (nextInfo != null) {
boolean xmlAttachmentRef = false;
String xmlMimeType = null;
java.lang.annotation.Annotation[] annotations = getAnnotations(nextInfo);
Class adapterClass = this.typeMappingInfoToAdapterClasses.get(nextInfo);
Class declJavaType = null;
if (adapterClass != null) {
declJavaType = CompilerHelper.getTypeFromAdapterClass(adapterClass);
}
if (annotations != null) {
for (int j = 0; j < annotations.length; j++) {
java.lang.annotation.Annotation nextAnnotation = annotations[j];
if (nextAnnotation != null) {
if (nextAnnotation instanceof XmlMimeType) {
XmlMimeType javaAnnotation = (XmlMimeType) nextAnnotation;
xmlMimeType = javaAnnotation.value();
} else if (nextAnnotation instanceof XmlAttachmentRef) {
xmlAttachmentRef = true;
}
}
}
}
QName qname = null;
String nextClassName = nextClass.getQualifiedName();
if (declJavaType != null) {
nextClassName = declJavaType.getCanonicalName();
}
if (typeMappingInfoToGeneratedClasses != null) {
Class generatedClass = typeMappingInfoToGeneratedClasses.get(nextInfo);
if (generatedClass != null) {
nextClassName = generatedClass.getCanonicalName();
}
}
TypeInfo nextTypeInfo = typeInfo.get(nextClassName);
if (nextTypeInfo != null) {
qname = new QName(nextTypeInfo.getClassNamespace(), nextTypeInfo.getSchemaTypeName());
} else {
qname = getUserDefinedSchemaTypes().get(nextClassName);
if (qname == null) {
if (nextClassName.equals(ClassConstants.ABYTE.getName()) || nextClassName.equals(ClassConstants.APBYTE.getName()) || nextClassName.equals(Image.class.getName()) || nextClassName.equals(Source.class.getName()) || nextClassName.equals("javax.activation.DataHandler")) {
if (xmlAttachmentRef) {
qname = XMLConstants.SWA_REF_QNAME;
} else {
qname = XMLConstants.BASE_64_BINARY_QNAME;
}
} else if (nextClassName.equals(ClassConstants.OBJECT.getName())) {
qname = XMLConstants.ANY_TYPE_QNAME;
} else if (nextClassName.equals(ClassConstants.XML_GREGORIAN_CALENDAR.getName())) {
qname = XMLConstants.ANY_SIMPLE_TYPE_QNAME;
} else {
Class theClass = helper.getClassForJavaClass(nextClass);
qname = (QName) XMLConversionManager.getDefaultJavaTypes().get(theClass);
}
}
}
if (qname != null) {
typeMappingInfoToSchemaType.put(nextInfo, qname);
}
if (nextInfo.getXmlTagName() != null) {
ElementDeclaration element = new ElementDeclaration(nextInfo.getXmlTagName(), nextClass, nextClass.getQualifiedName(), false);
element.setTypeMappingInfo(nextInfo);
element.setXmlMimeType(xmlMimeType);
element.setXmlAttachmentRef(xmlAttachmentRef);
if (declJavaType != null) {
element.setJavaType(helper.getJavaClass(declJavaType));
}
Class generatedClass = typeMappingInfoToGeneratedClasses.get(nextInfo);
if (generatedClass != null) {
element.setJavaType(helper.getJavaClass(generatedClass));
}
if (nextInfo.getElementScope() == TypeMappingInfo.ElementScope.Global) {
this.getGlobalElements().put(element.getElementName(), element);
} else {
this.localElements.add(element);
}
}