Wrapper for arbitrary values or objects [message #416132] |
Fri, 18 January 2008 15:26 |
Philipp Kutter 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 |
Ed Merks 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 |
Philipp Kutter 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
|
|
|
Powered by
FUDForum. Page generated in 0.03212 seconds