简体   繁体   English

在Eclipse之外运行EMore验证Ecore模型

[英]Run EMF Validation of an Ecore model outside of Eclipse

I found nothing how to validate an Ecore model outside of Eclipse. 我没有发现如何验证Eclipse之外的Ecore模型。 Does someone know how to do this? 有人知道怎么做吗?

Here is the skeleton of some code I've used to validate an EMF model outside of Eclipse: 以下是我用于验证Eclipse之外的EMF模型的一些代码的框架:

EValidator.Registry.INSTANCE.put(YourPackage.eINSTANCE, new YourValidator());

BasicDiagnostic diagnostics = new BasicDiagnostic();
boolean valid = true;
for (EObject eo : yourResource.getContents()) {
    Map<Object, Object> context = new HashMap<Object, Object>();
    valid &= Diagnostician.INSTANCE.validate(eo, diagnostics, context);
}

There is more customization you can do, but I hope that helps get you started. 你可以做更多的自定义,但我希望这有助于你开始。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM