packageName = packageName + "." + SourceGeneratorConstants.TYPES_PACKAGE;
} else {
packageName = SourceGeneratorConstants.TYPES_PACKAGE;
}
JClass tempClass = new JClass(packageName+ "." + temp.getJavaClassName());
xsType = new XSClass(tempClass);
xsType.setAsEnumerated(true);
}
}
}
if (xsType == null) {
xsType = component.getJavaType();
}
} else if (xmlType.isAnyType()) {
//-- Just treat as java.lang.Object.
if (classInfo != null) {
XMLInfoNature xmlNature = new XMLInfoNature(classInfo);
xsType = xmlNature.getSchemaType();
}
if (xsType == null) {
xsType = new XSClass(SGTypes.OBJECT);
}
} else if (xmlType.isComplexType() && (xmlType.getName() != null)) {
//--if we use the type method then no class is output for
//--the element we are processing
if (getConfig().mappingSchemaType2Java()) {
XMLBindingComponent temp = new XMLBindingComponent(
getConfig(), getGroupNaming());
temp.setBinding(component.getBinding());
temp.setView(xmlType);
ClassInfo typeInfo = resolver.resolve(xmlType);
if (typeInfo != null) {
// if we have not processed the <complexType> referenced
// by the ClassInfo yet, this will return null
// TODO find a way to resolve an unprocessed <complexType>
XMLInfoNature xmlNature = new XMLInfoNature(typeInfo);
xsType = xmlNature.getSchemaType();
} else {
String className = temp.getQualifiedName();
if (className != null) {
JClass jClass = new JClass(className);
if (((ComplexType) xmlType).isAbstract()) {
jClass.getModifiers().setAbstract(true);
}
xsType = new XSClass(jClass);
className = null;
}
}
}
} // complexType
} else {
if (xsType == null) {
xsType = component.getJavaType();
}
if (xsType == null) {
//-- patch for bug 1471 (No XMLType specified)
//-- treat unspecified type as anyType
switch (component.getAnnotated().getStructureType()) {
case Structure.ATTRIBUTE:
AttributeDecl attribute = (AttributeDecl) component.getAnnotated();
if (!attribute.hasXMLType()) {
xsType = new XSClass(SGTypes.OBJECT);
}
break;
case Structure.ELEMENT:
ElementDecl element = (ElementDecl) component.getAnnotated();
if (!element.hasXMLType()) {
xsType = new XSClass(SGTypes.OBJECT);
}
break;
default:
// probably a model-group
break;
}
}
}
// is the XSType found?
if (xsType == null) {
String className = component.getQualifiedName();
JClass jClass = new JClass(className);
if (component.isAbstract()) {
jClass.getModifiers().setAbstract(true);
}
if (getConfig().isAutomaticConflictResolution()) {
getSourceGenerator().getXMLInfoRegistry().bind(jClass,
component, "field");
}
xsType = new XSClass(jClass);
if (xmlType != null && xmlType.isComplexType()) {
ComplexType complexType = (ComplexType) xmlType;
if (complexType.isAbstract() || getConfig().mappingSchemaElement2Java()) {
jClass.getModifiers().setAbstract(true);
}