* Creates the correct instance for the given type name.
* Valid only for built in type names.
*/
private SimpleType createInstance(Schema schema, String builtInTypeName)
{
Type type= getType(builtInTypeName);
//If the type is derived by list, return a new ListType.
String derivation= type.getDerivedBy();
ListType resultList = null;
if ( (derivation != null) && (derivation.equals(SchemaNames.LIST)) ) {
try {
resultList = new ListType(schema);
}
catch(SchemaException sx) {
//-- This should not happen...but who knows!
throw new SimpleTypesFactoryException(sx);
}
}
//Finds the primitive ancestor (defines the class that represents it)
Class implClass= null;
while (type != null) {
if (type.getImplClass() != null) {
implClass= type.getImplClass();
break;
}
type= getType(type.getBase());
}
if (implClass == null) return null;
SimpleType result;