在xtext中生成静态对象

时间:2012-11-04 09:56:17

标签: code-generation xtext xtend

继续生成如下字段的示例:

def handle (EClass c) {
  val attr = EcoreFactory::eINSTANCE.createEAttribute
  attr.name = "test"
  attr.EType = EcorePackage::eINSTANCE.EString
  c.EStructuralFeatures += attr
}

我可以将它生成为静态字段吗?该怎么做?

提前感谢,

1 个答案:

答案 0 :(得分:0)

Ecore与Java的对象模型不同,不幸的是,EAttributes不能像Java中的字段那样是静态的。