2014-08-29 80 views
2

的列表我试图创建一个代表我的模型的ecore文件。EMF不生成类型为

我碰到的问题然而,因为当我生成模型, java文件包含

EList getFunctions(); 

,而不是

EList<Function> getFunctions(); 

我在哪里可以选择EMF添加类型列表?编辑: 我确实指定了属性。下面是我的配置的截图: http://i.imgur.com/RE9drmO.png (sorry for the link, don't have enough reputation to post directly)

下面是针对FunctionCall产生的界面(我删除自动生成的注释):

import org.eclipse.emf.common.util.EList; 
import org.eclipse.emf.ecore.EObject; 

public interface FunctionCall extends EObject { 

    Function getSource(); 
    void setSource(Function value); 

    Function getTarget(); 
    void setTarget(Function value); 

    DependencyGraph getDg(); 
    void setDg(DependencyGraph value); 

    EList getBendpoints(); 

} // FunctionCall 

问题 “解决”:

经过漫长的游戏并没有成功,我重新安装了Eclipse(并且完全擦除了我的设置&项目设置)。我已经重新导入了我的项目,现在它似乎工作。 我不知道为什么,尽管...

+0

这里的任何解决方案?我得到了同样的问题 – gorootde 2014-10-08 17:16:58

+1

检查你的'.genmodel'文件配置,也许你让java-1.5兼容? – 2015-03-01 15:27:01

+0

嗨,事实证明,我的Eclipse安装完全搞砸了,完全重新安装(包括新下载)后,它工作正常。 – stklik 2015-03-02 12:06:33

回答

0

您可以在EType属性中指定类型。为了将属性指定为EList,需要将上限设置为-1。

+0

@ S.K你能更具体地了解这个问题吗?你能不能请分享从FunctionCall类生成的java文件? – 2014-08-29 11:35:52

+0

问题也在这里显示: [link](http://help.eclipse.org/juno/index.jsp?topic=%2Forg.eclipse.emf.doc%2Freferences%2Foverview%2FEMF.html&anchor=generation) 如果您滚动到**多重性 - 许多参考**,您可以看到方法_getBooks()_返回一个'EList'而不是'EList '。 这个例子让它更容易理解吗? – stklik 2014-08-29 11:39:22

+0

你可以尝试创建一个新的EReference的孩子而不是EAttribute并让我知道吗? – 2014-08-29 13:26:01