else if (XSDConstants.isSchemaForSchemaNamespace(xsdSimpleTypeDefinition.getTargetNamespace()))
{
String name = xsdSimpleTypeDefinition.getName();
if (name != null)
{
EDataType result = (EDataType)getBuiltInEClassifier(xsdSimpleTypeDefinition.getTargetNamespace(), "anyType".equals(name) ? "anySimpleType" : name);
if (result != null)
{
return result;
}
}
}
else if (xsdSimpleTypeDefinition.getContainer() == null)
{
return (EDataType)getBuiltInEClassifier(rootSchema.getSchemaForSchemaNamespace(), "anySimpleType");
}
String explicitInstanceClassName = getEcoreAttribute(xsdSimpleTypeDefinition, "instanceClass");
if (explicitInstanceClassName != null)
{
EDataType eDataType = ecoreFactory.createEDataType();
setAnnotations(eDataType, xsdSimpleTypeDefinition);
String aliasName = getEcoreAttribute(xsdSimpleTypeDefinition, "name");
if (aliasName == null)
{
aliasName = validAliasName(xsdSimpleTypeDefinition, true);
}
eDataType.setName(aliasName);
extendedMetaData.setName(eDataType, xsdSimpleTypeDefinition.getAliasName());
eDataType.setInstanceClassName(explicitInstanceClassName);
EPackage ePackage = getEPackage(xsdSimpleTypeDefinition);
addToSortedList(ePackage.getEClassifiers(), eDataType);
checkForPrimitive(xsdSimpleTypeDefinition, eDataType);
handleFacets(xsdSimpleTypeDefinition, eDataType);
String constraints = getEcoreAttribute(xsdSimpleTypeDefinition, "constraints");
if (constraints != null)
{
EcoreUtil.setAnnotation(eDataType, EcorePackage.eNS_URI, "constraints", constraints);
}
if ("false".equals(getEcoreAttribute(xsdSimpleTypeDefinition, "serializable")))
{
eDataType.setSerializable(false);
}
return eDataType;
}
else
{
EEnum eEnum = computeEEnum(xsdSimpleTypeDefinition);
if (eEnum != null)
{
return eEnum;
}
else
{
XSDSimpleTypeDefinition baseTypeDefinition = xsdSimpleTypeDefinition.getBaseTypeDefinition();
if (baseTypeDefinition != null)
{
EDataType eDataType = ecoreFactory.createEDataType();
setAnnotations(eDataType, xsdSimpleTypeDefinition);
String name = getEcoreAttribute(xsdSimpleTypeDefinition, "name");
if (name == null)
{
name = validAliasName(xsdSimpleTypeDefinition, true);
}
eDataType.setName(name);
extendedMetaData.setName(eDataType, xsdSimpleTypeDefinition.getAliasName());
EPackage ePackage = getEPackage(xsdSimpleTypeDefinition);
addToSortedList(ePackage.getEClassifiers(), eDataType);
if (baseTypeDefinition.getVariety() != xsdSimpleTypeDefinition.getVariety())
{
if (xsdSimpleTypeDefinition.getVariety() == XSDVariety.LIST_LITERAL)
{
EDataType itemEDataType = getEDataType(xsdSimpleTypeDefinition.getItemTypeDefinition());
extendedMetaData.setItemType(eDataType, itemEDataType);
eDataType.setInstanceClassName("java.util.List");
}
else
{
String instanceClassName = null;
List memberTypes = new ArrayList();
for (Iterator i = xsdSimpleTypeDefinition.getMemberTypeDefinitions().iterator(); i.hasNext(); )
{
XSDSimpleTypeDefinition memberTypeDefinition = (XSDSimpleTypeDefinition)i.next();
EDataType memberEDataType = getEDataType(memberTypeDefinition);
memberTypes.add(memberEDataType);
String memberInstanceClassName = memberEDataType.getInstanceClassName();
if (memberInstanceClassName == null && memberEDataType instanceof EEnum)
{
memberInstanceClassName = "org.eclipse.emf.common.util.Enumerator";
}
if (instanceClassName == null)
{
instanceClassName = memberInstanceClassName;
}
else if (instanceClassName != memberInstanceClassName)
{
instanceClassName = "java.lang.Object";
}
}
extendedMetaData.setMemberTypes(eDataType, memberTypes);
eDataType.setInstanceClassName(instanceClassName);
}
}
else
{
EDataType baseEDataType = getEDataType(baseTypeDefinition);
extendedMetaData.setBaseType(eDataType, baseEDataType);
String instanceClassName = getInstanceClassName(xsdSimpleTypeDefinition, baseEDataType);
eDataType.setInstanceClassName
(instanceClassName == null ?
"org.eclipse.emf.common.util.Enumerator" :