开发者

Run EMF Validation of an Ecore model outside of Eclipse

开发者 https://www.devze.com 2023-01-15 12:41 出处:网络
I found nothing how to validate an Eco开发者_如何学编程re model outside of Eclipse. Does someone know how to do this?Here is the skeleton of some code I\'ve used to validate an EMF model outside of Ec

I found nothing how to validate an Eco开发者_如何学编程re model outside of Eclipse. 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:

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号