八进制

少年壮志无烟抽

  博客园 :: 首页 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::
  240 随笔 :: 0 文章 :: 3330 评论 :: 14 引用

EReference的containment属性如果为true,表示目标EClass是被源EClass包含的,这是一种十分强的关系,例如汽车和车轮的关系。在ecore里,不允许包含关系形成圈,也就是说如果A包含B,B就不能再直接或间接的包含A;另外,如果作为容器的对象结束了自己的生命周期,被它包含的对象也将结束自己的生命周期。

如果一个EReference有作为EOpposite的EReference,并且后者的containment属性为true,则这个EReference的container属性为true。说白了,一个EReference的container属性表示它指向的EClass是否为包含者。

public boolean isContainer()
{
  EReference theOpposite 
= getEOpposite();
  
return theOpposite != null && theOpposite.isContainment();
}

最后,container属性是derived属性,所以在ecore编辑器里我们无法直接编辑一个EReference的这个属性。

http://dev.eclipse.org/newslists/news.eclipse.tools.emf/msg01448.html

posted on 2006-11-20 21:36 八进制 阅读(3165) 评论(0) 编辑 收藏