【问题标题】:EProxy URI does not resolve in ecore modelEProxy URI 在 ecore 模型中无法解析
【发布时间】:2013-06-17 07:01:23
【问题描述】:

在我的 Ecore 模型中,来自当前模型之外的所有类型都不会被它们的代理解析。 getType()返回的对象的所有字段都是null,运行时只填写存储类型URI。

这是我的模型的摘录:

<?xml version="1.0" encoding="UTF-8"?>
<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="model" nsURI="http:///model.ecore" nsPrefix="model">
  <eSubpackages name="general" nsURI="http:///model/general.ecore" nsPrefix="model.general">
    <eClassifiers xsi:type="ecore:EClass" name="Address">
      <eStructuralFeatures xsi:type="ecore:EAttribute" name="street" ordered="false" lowerBound="1"
      eType="ecore:EDataType platform:/plugin/org.eclipse.uml2.types/model/Types.ecore#//String"/>
    </eClassifiers>
  </eSubpackages>
</ecore:EPackage>

目前如果我做一个

Address a = <address item from model>
Type t = a.getType();

t 的所有字段都将是 null,toString() 返回如下内容:

org.eclipse.uml2.uml.internal.impl.PrimitiveTypeImpl@6e315086 (eProxyURI:
 platform:/plugin/org.eclipse.uml2.types/model/Types.ecore#//String)

【问题讨论】:

    标签: eclipse-emf ecore


    【解决方案1】:

    将代理 URI 从 platform:/plugin/org.eclipse.uml2.types/model/Types.ecore#//String 更改为包含数据类型的包的 NS URI:http://www.eclipse.org/uml2/4.0.0/Types#//String。

    请注意,此更改只能在文本编辑器中完成。

    【讨论】:

      猜你喜欢
      • 2021-03-12
      • 2020-01-11
      • 1970-01-01
      • 1970-01-01
      • 2012-08-05
      • 1970-01-01
      • 2017-10-17
      • 2012-04-04
      • 2019-04-20
      相关资源
      最近更新 更多