Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » EDataType instanceClass
EDataType instanceClass [message #428159] Thu, 12 March 2009 07:47 Go to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Ed,
I am wondering how to correctly determine the instanceclass of an EAttribute. There is the instanceclass but I also
remember that there are cases whereby the edatatype has extendedmetadata with itemtype, membertype and basetype keys. I
am not sure what to expect in which cases.

As far as I can see there are the following cases:
- the edatatype is a primitive type: in this case edatattype.instanceclass should be used
- the edatatype has a collection/generic type with an item type. So in this case there are two types: the generic type
and the item type, correct?
- other cases?

Does EMF have some nice handy utility methods to retrieve the above info?

--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: EDataType instanceClass [message #428172 is a reply to message #428159] Thu, 12 March 2009 14:48 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33217
Registered: July 2009
Senior Member
Martin,

Comments below.

Martin Taal wrote:
> Hi Ed,
> I am wondering how to correctly determine the instanceclass of an
> EAttribute. There is the instanceclass but I also remember that there
> are cases whereby the edatatype has extendedmetadata with itemtype,
> membertype and basetype keys. I am not sure what to expect in which
> cases.
>
> As far as I can see there are the following cases:
> - the edatatype is a primitive type: in this case
> edatattype.instanceclass should be used
In all cases, except for a dynamic EEnum, there will be a instance class.

Any EDataType might have a non-null
ExtendedMetaData.INSTANCE.getBaseType(), but the instance class of that
base type must be the same. Such a data type generally will have
restricting facets of some sort.
> - the edatatype has a collection/generic type with an item type.
Yes, a java.util.List instance class might have a non-null
ExtendedMetaData.INSTANCE.getItemType(). The value will be a list of
instances of this item type.
> So in this case there are two types: the generic type and the item
> type, correct?
Yes.
> - other cases?
A data type might have a non-empty list of
ExtendedMetaData.INSTANCE.getMemberTypes(). The instance class of the
union must be a common type that allows any of the member types. That
might well mean it's java.lang.Object.
>
> Does EMF have some nice handy utility methods to retrieve the above info?
It does. I wonder about the context of the question though...


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: EDataType instanceClass [message #428174 is a reply to message #428172] Thu, 12 March 2009 14:58 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Ed,
About the contexts, there are two:
- I am generating code using xpand and emf models
- I wrote a test data generator which needs to know the class of an eattribute to do test data generation

But I can see that I can use the ExtendedMetadata.INSTANCE to get to this information without me parsing the metadata
itself.

You say this:
> A data type might have a non-empty list of
> ExtendedMetaData.INSTANCE.getMemberTypes(). The instance class of the
> union must be a common type that allows any of the member types. That
> might well mean it's java.lang.Object.

the instance class of the union would be in the EAttribute.eDataType?

gr. Martin

Ed Merks wrote:
> Martin,
>
> Comments below.
>
> Martin Taal wrote:
>> Hi Ed,
>> I am wondering how to correctly determine the instanceclass of an
>> EAttribute. There is the instanceclass but I also remember that there
>> are cases whereby the edatatype has extendedmetadata with itemtype,
>> membertype and basetype keys. I am not sure what to expect in which
>> cases.
>>
>> As far as I can see there are the following cases:
>> - the edatatype is a primitive type: in this case
>> edatattype.instanceclass should be used
> In all cases, except for a dynamic EEnum, there will be a instance class.
>
> Any EDataType might have a non-null
> ExtendedMetaData.INSTANCE.getBaseType(), but the instance class of that
> base type must be the same. Such a data type generally will have
> restricting facets of some sort.
>> - the edatatype has a collection/generic type with an item type.
> Yes, a java.util.List instance class might have a non-null
> ExtendedMetaData.INSTANCE.getItemType(). The value will be a list of
> instances of this item type.
>> So in this case there are two types: the generic type and the item
>> type, correct?
> Yes.
>> - other cases?
> A data type might have a non-empty list of
> ExtendedMetaData.INSTANCE.getMemberTypes(). The instance class of the
> union must be a common type that allows any of the member types. That
> might well mean it's java.lang.Object.
>>
>> Does EMF have some nice handy utility methods to retrieve the above info?
> It does. I wonder about the context of the question though...


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: EDataType instanceClass [message #428176 is a reply to message #428174] Thu, 12 March 2009 15:14 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33217
Registered: July 2009
Senior Member
Martin,

Comments below.

Martin Taal wrote:
> Hi Ed,
> About the contexts, there are two:
> - I am generating code using xpand and emf models
> - I wrote a test data generator which needs to know the class of an
> eattribute to do test data generation
The GenModel has all the sophisticated logic for determining the Java
type names to use. It would seem better to reuse that...
>
> But I can see that I can use the ExtendedMetadata.INSTANCE to get to
> this information without me parsing the metadata itself.
>
> You say this:
> > A data type might have a non-empty list of
> > ExtendedMetaData.INSTANCE.getMemberTypes(). The instance class of the
> > union must be a common type that allows any of the member types. That
> > might well mean it's java.lang.Object.
>
> the instance class of the union would be in the EAttribute.eDataType?
Yes.
>
> gr. Martin
>
> Ed Merks wrote:
>> Martin,
>>
>> Comments below.
>>
>> Martin Taal wrote:
>>> Hi Ed,
>>> I am wondering how to correctly determine the instanceclass of an
>>> EAttribute. There is the instanceclass but I also remember that
>>> there are cases whereby the edatatype has extendedmetadata with
>>> itemtype, membertype and basetype keys. I am not sure what to expect
>>> in which cases.
>>>
>>> As far as I can see there are the following cases:
>>> - the edatatype is a primitive type: in this case
>>> edatattype.instanceclass should be used
>> In all cases, except for a dynamic EEnum, there will be a instance
>> class.
>>
>> Any EDataType might have a non-null
>> ExtendedMetaData.INSTANCE.getBaseType(), but the instance class of
>> that base type must be the same. Such a data type generally will
>> have restricting facets of some sort.
>>> - the edatatype has a collection/generic type with an item type.
>> Yes, a java.util.List instance class might have a non-null
>> ExtendedMetaData.INSTANCE.getItemType(). The value will be a list of
>> instances of this item type.
>>> So in this case there are two types: the generic type and the item
>>> type, correct?
>> Yes.
>>> - other cases?
>> A data type might have a non-empty list of
>> ExtendedMetaData.INSTANCE.getMemberTypes(). The instance class of
>> the union must be a common type that allows any of the member types.
>> That might well mean it's java.lang.Object.
>>>
>>> Does EMF have some nice handy utility methods to retrieve the above
>>> info?
>> It does. I wonder about the context of the question though...
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:[commercial, off-topic?] Need external review. Data models, meta-data and database integration for r
Next Topic:EMF Test Data Generation?
Goto Forum:
  


Current Time: Tue Sep 24 09:49:53 GMT 2024

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

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

Back to the top