protected void convertConstraints(EClass eClass, Type type) {
if (type.getConstraints().size() > 0) {
// EMF Annotation
EAnnotation annotation_emf = EcoreFactory.eINSTANCE.createEAnnotation();
annotation_emf.setSource("http://www.eclipse.org/emf/2002/Ecore");
String value = "";
// OCL Annotation
EAnnotation annotation_ocl = EcoreFactory.eINSTANCE.createEAnnotation();
annotation_ocl.setSource("http://www.eclipse.org/emf/2002/Ecore/OCL/Pivot");
for (Constraint constraint : type.getConstraints()) {
annotation_ocl.getDetails().put(constraint.getName(),
convertbody(constraint.getBody(), (Extension) type.eContainer()));
if (value.equals("")) {
value += constraint.getName();
} else {
value += " ";
value += constraint.getName();
}
// convertbody(constraint.getBody(), (Extension)
// type.eContainer());
}
annotation_emf.getDetails().put("constraints", value);
eClass.getEAnnotations().add(annotation_emf);
eClass.getEAnnotations().add(annotation_ocl);
}
}
OCCIExtension2Ecore.java 文件源码
java
阅读 23
收藏 0
点赞 0
评论 0
项目:OCCI-Studio
作者:
评论列表
文章目录