private static Survey loadSurveyModel(String modulePath) {
// Initialize the model
QueryITPackage.eINSTANCE.eClass();
Resource.Factory.Registry reg = Resource.Factory.Registry.INSTANCE;
Map<String, Object> m = reg.getExtensionToFactoryMap();
m.put("xmi", new XMIResourceFactoryImpl());
m.put("ecore", new EcoreResourceFactoryImpl());
// Obtain a new resource set
ResourceSet resSet = new ResourceSetImpl();
// Get the resource
//Resource resource = resSet.getResource(URI.createFileURI(modulePath), true);
Resource resource = resSet.getResource(URI.createURI(modulePath), true);
// Get the first model element and cast it to the right type, in my
// example everything is included in this first node
Survey s = (Survey) resource.getContents().get(0);
return s;
}
SurveyGenerator.java 文件源码
java
阅读 15
收藏 0
点赞 0
评论 0
项目:SurveyDSL
作者:
评论列表
文章目录