`
Dollyn
  • 浏览: 168742 次
  • 性别: Icon_minigender_1
  • 来自: 杭州
社区版块
存档分类
最新评论

Object *** is not contained in a resource.

    博客分类:
  • EMF
阅读更多

I get a DanglingHREFException: e.g., "org.eclipse.emf.ecore.xmi.DanglingHREFException: The object 'com.example.Foo@2f5dda ()' is not contained in a resource." What do I need to do?

All objects need to be contained by a resource in order to be serialized. That implies that for EObject x to be serialized, it must be the case that x.eResource() != null. The resource will be non-null if either x is directly contained by a resource, i.e., if for Resource r, r.getContents().contains(x), or if x has a container that in turn is contained by a resource, i.e., if for Resource r, r.getContents().contains(x.eContainer()). This definition is recursive. So an object must be contained by a resource directly, or indirectly by virtue of being part of a containment reference where, recursively, the container too must be contained by a resource.

So if you get the above exception, that means you have some object x contained by a resource r that refers to another object y, that is not directly or indirectly contained by any resource. It's possible to make the EReference feature used by x to refer to y be transient, so that it's not saved at all, or to make it a containment reference, so that y is contained by the same resource as x, but barring changes to the Ecore model itself, the one and only way to solve this problem is to add y to some resource, i.e., r.getContents().add(y), or to add/set it to some containment reference of an object z, i.e., z.getYs().add(y), where z is already contained by a resource, i.e., z.eResource() != null

 

转自:http://wiki.eclipse.org/index.php/EMF-FAQ#I_get_a_DanglingHREFException:_e.g..2C_.22org.eclipse.emf.ecore.xmi.DanglingHREFException:_The_object_.27com.example.Foo.402f5dda_.28.29.27_is_not_contained_in_a_resource..22_What_do_I_need_to_do.3F

 

分享到:
评论

相关推荐

    Delphi7.1 Update

    and supersedes information contained in otherdocuments, including previously installed release notes.Borland recommends that you read this file in its entirety.NOTE: If you are updating a localized ...

    servlet2.4doc

    A filter is an object that performs filtering tasks on either the request to a resource (a servlet or static content), or on the response from a resource, or both. Filters perform filtering in the ...

    Java邮件开发Fundamentals of the JavaMail API

    It is not a mail transfer protocol. Instead, it defines the content of what is transferred: the format of the messages, attachments, and so on. There are many different documents that take effect ...

    LCTF软件备份VariSpec™ Liquid Crystal Tunable Filters

    All files are contained in a single installer file which includes the following: vsdrvr.h declaration file vsdrvr.lib library stub file vsdrvr.dll run-time library vsdrvr_r1p30.pdf (this file) ...

    EhLib 9.1.024

    Allows to type (assign) values to Text property not contained in data list (Style = csDropDownEh). Allows to hold KeyValue and Text as not affecting to each other values. Take effect when Key...

    A Tour of C++, 2nd Edition

    This concise, self-contained guide covers most major language features and the major standard-library components—not, of course, in great depth, but to a level that gives programmers a meaningful ...

    ehlib_vcl_src_9_3.26

    Allows to type (assign) values to Text property not contained in data list (Style = csDropDownEh). Allows to hold KeyValue and Text as not affecting to each other values. Take effect when Key...

    acpi控制笔记本风扇转速

    A buffer object is also allowed as the source operand. BZ 480 Fixed a problem where the Load ASL operator allowed the source operand to be an operation region of any type. It is now restricted to ...

    jdk-9.0.1_doc-all 最新版

    Defines the subset of the W3C Document Object Model (DOM) API that is not part of the Java SE API. jdk.zipfs Provides the implementation of the zip file system provider. JavaFX Module Description ...

    数位板压力测试

    The definition is not lim¬ited to de¬vices that use a physical tablet. In fact, this specification can support de¬vices that combine rela¬tive and absolute pointing as well as purely relative ...

Global site tag (gtag.js) - Google Analytics