SurveyGenerator.java 文件源码

java
阅读 16 收藏 0 点赞 0 评论 0

项目:SurveyDSL 作者:
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;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号