Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Wrapper for arbitrary values or objects
Wrapper for arbitrary values or objects [message #416132] Fri, 18 January 2008 15:26 Go to next message
Philipp Kutter is currently offline Philipp KutterFriend
Messages: 306
Registered: July 2009
Senior Member
Hi.
Has anyone an idea what is the most elegant solution for a
wrapper for values of some EDataYype, and objects of some EClass?

We need to define an EStructuralFeature which can point both to any
EObject, or any of EInt, EBoolean, EString, e.t.c.

Creating a class

Wrapper(type: EType, many: boolean, objectValue: EObject*, intValue:
EInt*, ...)

is obvious, but then the OCL expressions over this get very ugly.

Best, Philipp
Re: Wrapper for arbitrary values or objects [message #416134 is a reply to message #416132] Fri, 18 January 2008 15:35 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
Phillip,

An instance of SimpleAnyType is an EObject and can have its
setInstanceType be called to reference any EDataType and then setValue
or setRawValue can be used to set an instance of that type or a literal
representation of an instance of that type so in that way it acts as a
wrapper. This is what's created when a serialized instance uses
xsi:type="..." where "..." refers to an EDataType rather than an EClass...


Philipp W. Kutter wrote:
> Hi.
> Has anyone an idea what is the most elegant solution for a
> wrapper for values of some EDataYype, and objects of some EClass?
>
> We need to define an EStructuralFeature which can point both to any
> EObject, or any of EInt, EBoolean, EString, e.t.c.
>
> Creating a class
>
> Wrapper(type: EType, many: boolean, objectValue: EObject*, intValue:
> EInt*, ...)
>
> is obvious, but then the OCL expressions over this get very ugly.
>
> Best, Philipp


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Wrapper for arbitrary values or objects [message #416140 is a reply to message #416134] Fri, 18 January 2008 16:01 Go to previous message
Philipp Kutter is currently offline Philipp KutterFriend
Messages: 306
Registered: July 2009
Senior Member
Hi, Ed.
It seems this is exactly what we need.

Thanks a lot.

Best, Philipp

Ed Merks wrote:
> Phillip,
>
> An instance of SimpleAnyType is an EObject and can have its
> setInstanceType be called to reference any EDataType and then setValue
> or setRawValue can be used to set an instance of that type or a literal
> representation of an instance of that type so in that way it acts as a
> wrapper. This is what's created when a serialized instance uses
> xsi:type="..." where "..." refers to an EDataType rather than an EClass...
>
>
> Philipp W. Kutter wrote:
>> Hi.
>> Has anyone an idea what is the most elegant solution for a
>> wrapper for values of some EDataYype, and objects of some EClass?
>>
>> We need to define an EStructuralFeature which can point both to any
>> EObject, or any of EInt, EBoolean, EString, e.t.c.
>>
>> Creating a class
>>
>> Wrapper(type: EType, many: boolean, objectValue: EObject*, intValue:
>> EInt*, ...)
>>
>> is obvious, but then the OCL expressions over this get very ugly.
>>
>> Best, Philipp
Previous Topic:The "best way" to handle external resource changes?
Next Topic:Custom code after initialization (Short question)
Goto Forum:
  


Current Time: Thu Apr 25 21:10:06 GMT 2024

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

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

Back to the top