Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Trouble adding an EDatatype of an EAttribute
Trouble adding an EDatatype of an EAttribute [message #771443] Tue, 27 December 2011 09:14 Go to next message
jpfse   is currently offline jpfse Friend
Messages: 18
Registered: December 2011
Junior Member
Hello,

I´m developing a tool that takes as input java classes and produces as result a .ecore file representing the input files as good as possible, in order to generate the same domain based on EMF.
The problem is adding a datatype of an attribute. In anex (teste.java) is the code I have to create an EAttribute and the respective EDatatype.
As you can see, I have a line to add the eDataType to the outputRes. If I remove that line, it returns the following exception:

Exception in thread "main" org.eclipse.emf.ecore.resource.Resource$IOWrappedException: The object 'org.eclipse.emf.ecore.impl.EDataTypeImpl@19189e1 (name: null) (instanceClassName: java.lang.Object) (serializable: true)' is not contained in a resource.

With the line, the exception is gone, but the resoulting .ecore (is in anex, teste.ecore) is not correct. I was expecting the datatypes to be placed like the file expected.ecore in anex

Any ideas?

Tanks!
  • Attachment: expected.ecore
    (Size: 0.13KB, Downloaded 165 times)
  • Attachment: teste.ecore
    (Size: 1.37KB, Downloaded 227 times)
  • Attachment: teste.java
    (Size: 0.84KB, Downloaded 174 times)
Re: Trouble adding an EDatatype of an EAttribute [message #774076 is a reply to message #771443] Tue, 03 January 2012 08:12 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
You have to be sure you add the EDataType to the EPackage's eClassifiers
as well as to reference it as the eType of an EAttribute.


On 27/12/2011 10:14 AM, Missing name Mising name wrote:
> Hello,
>
> I´m developing a tool that takes as input java classes and produces as result a .ecore file representing the input files as good as possible, in order to generate the same domain based on EMF.
> The problem is adding a datatype of an attribute. In anex (teste.java) is the code I have to create an EAttribute and the respective EDatatype.
> As you can see, I have a line to add the eDataType to the outputRes. If I remove that line, it returns the following exception:
>
> Exception in thread "main" org.eclipse.emf.ecore.resource.Resource$IOWrappedException: The object mailto:'org.eclipse.emf.ecore.impl.EDataTypeImpl@19189e1 (name: null) (instanceClassName: java.lang.Object) (serializable: true)' is not contained in a resource.
>
> With the line, the exception is gone, but the resoulting .ecore (is in anex, teste.ecore) is not correct. I was expecting the datatypes to be placed like the file expected.ecore in anex
>
> Any ideas?
>
> Tanks!


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:Modeling data using external APIs
Next Topic:[CDO] Notification#getOldValue always null?
Goto Forum:
  


Current Time: Thu Apr 25 23:41:16 GMT 2024

Powered by FUDForum. Page generated in 0.02746 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top