Is it possible to generate Java code from a resource only loaded in memory? [message #1802418] |
Fri, 08 February 2019 14:40 |
Pablo Gomez Abajo Messages: 8 Registered: February 2019 |
Junior Member |
|
|
Hi,
I would like to know if it is possible to generate Java code form a resource loaded in memory and not stored in the disk with MoDisco.
I would like to do something like this:
JavaPackage.eINSTANCE.eClass();
GenerateJavaExtended javaGenerator = new GenerateJavaExtended(model, new File(folder), new ArrayList<Object>());
javaGenerator.doGenerate(null);
where the model variable is the resource obtained after applying the MoDisco discoverer to a Java project, which is loaded in memory and modified, and not stored in the disk after these modifications (The expected behavior is that these modifications will be reflected in the generated Java code).
I know there is a version of this GenerateJavaExtended method which accepts an EObject as the first parameter, and I tried to pass the root object of the Java project model as this first argument but didn't manage to make it work.
I manage to make this work but when I serialize the model onto the disk after applying the modifications, and passing the resource's URI as the first argument:
GenerateJavaExtended javaGenerator = new GenerateJavaExtended(model.getURI(), new File(folder), new ArrayList<Object>());
I would appreciate any help. Many thanks in advance,
Pablo
|
|
|
|
Powered by
FUDForum. Page generated in 0.03330 seconds