EPackage.Registry packageRegistry = new EPackageRegistryImpl(EPackage.Registry.INSTANCE);
// Create an EPackage for the generated SDO
if (packageURI == null)
packageURI = "http://" + javaPackage;
EPackage implEPackage = EcoreFactory.eINSTANCE.createEPackage();
implEPackage.setNsURI(packageURI);
String shortName = shortName(packageURI);
implEPackage.setName(shortName);
implEPackage.setNsPrefix(shortName.toLowerCase());
packageRegistry.put(packageURI, implEPackage);
// Create EClasses for all the given Java interfaces
Map eClasses = new HashMap();
for (Iterator iter = javaInterfaces.iterator(); iter.hasNext();)
{
String interfaceName = (String)iter.next();
Class instanceClass = Class.forName(interfaceName, true, classLoader);
EClass implEClass = EcoreFactory.eINSTANCE.createEClass();
String className = shortName(instanceClass.getName());
implEClass.setName(className);
implEClass.setInstanceClass(instanceClass);
eClasses.put(instanceClass, implEClass);
implEPackage.getEClassifiers().add(implEClass);
}
// Populate the EClasses with EAttributes and EReferences for their properties
for (Iterator iter = implEPackage.getEClassifiers().iterator(); iter.hasNext();)
{
EClass implEClass = (EClass)iter.next();
Class instanceClass = implEClass.getInstanceClass();
Method[] methods = instanceClass.getMethods();
for (int m = 0; m < methods.length; m++)