fillFieldTypes(typeDescr,
packageDescr);
if (!typeDescr.getNamespace().equals(packageDescr.getNamespace())) {
// If the type declaration is for a different namespace, process that separately.
PackageDescr altDescr = null;
if ( foreignPackages == null ) {
foreignPackages = new HashMap<String, PackageDescr>( );
}
if ( foreignPackages.containsKey( typeDescr.getNamespace() ) ) {
altDescr = foreignPackages.get( typeDescr.getNamespace() );
} else {
altDescr = new PackageDescr(typeDescr.getNamespace());
foreignPackages.put( typeDescr.getNamespace(), altDescr );
}
if (typeDescr instanceof TypeDeclarationDescr) {
altDescr.addTypeDeclaration((TypeDeclarationDescr) typeDescr);
} else if (typeDescr instanceof EnumDeclarationDescr) {
altDescr.addEnumDeclaration((EnumDeclarationDescr) typeDescr);
}
for (ImportDescr imp : packageDescr.getImports()) {
altDescr.addImport(imp);
}
if (!getPackageRegistry().containsKey(altDescr.getNamespace())) {
newPackage(altDescr);
}
}
}
}