Re: How retrieve DefaultValue of a Property [message #632591] |
Wed, 13 October 2010 14:13 |
Ed Merks Messages: 33140 Registered: July 2009 |
Senior Member |
|
|
Tom,
This sounds like a UML2 question that's best asked on the UML2
newsgroup, which I've added to the "to" list of the reply, so no need to
repost. I bet if you used the debugger (your best friend) to look at
the instance you'd know which field stores the value and then you could
look at the source code to see which method returns that field...
Tom Brandenburg wrote:
> Hello,
>
> currently I convert XMI files, to be processed in Eclipse. Following
> extract of the XMI:
>
> <ownedAttribute xmi:type="uml:Property" name="testAttr2"
> xmi:id="BOUML_0x27617_1" visibility="public">
> <defaultValue xmi:type="uml:LiteralString"
> xmi:id="BOUML_VALUE_0x27617_1" value="56"/>
> </ownedAttribute>
>
> evaluates to the following tree structure of the LiteralString:
>
> obj (LiteralStringImpl)
> |
> +- ...
> +- eContainer (PropertyImpl)
> |
> +- ...
> +- defaultValue (LiteralStringImpl)
> |
> +- ...
> +- value ("56")
>
> But with what method of "obj" I get the value "56" of the defaultValue?
>
> Thanks in advance and best regards
> Tom
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Re: How retrieve DefaultValue of a Property [message #632652 is a reply to message #632591] |
Wed, 13 October 2010 17:15 |
Ed Willink Messages: 7655 Registered: July 2009 |
Senior Member |
|
|
Hi Tom
I'm not a major UML expert, but it looks as if defaultValue is not part
of the model, just the meta-model, so:
At the modeling level you need an OCL ability to navigate the meta-model
that is not currently available (under discussion).
Pragmatically, you can just create a new object and see what value it
gets by default.
Using Ecore reflection you can navigate to the EClass and then the
EAttribute where the default value is reified.
Regards
Ed Willink
On 13/10/2010 15:13, Ed Merks wrote:
> Tom,
>
> This sounds like a UML2 question that's best asked on the UML2
> newsgroup, which I've added to the "to" list of the reply, so no need to
> repost. I bet if you used the debugger (your best friend) to look at the
> instance you'd know which field stores the value and then you could look
> at the source code to see which method returns that field...
>
>
> Tom Brandenburg wrote:
>> Hello,
>>
>> currently I convert XMI files, to be processed in Eclipse. Following
>> extract of the XMI:
>>
>> <ownedAttribute xmi:type="uml:Property" name="testAttr2"
>> xmi:id="BOUML_0x27617_1" visibility="public">
>> <defaultValue xmi:type="uml:LiteralString"
>> xmi:id="BOUML_VALUE_0x27617_1" value="56"/>
>> </ownedAttribute>
>>
>> evaluates to the following tree structure of the LiteralString:
>>
>> obj (LiteralStringImpl)
>> |
>> +- ...
>> +- eContainer (PropertyImpl)
>> |
>> +- ...
>> +- defaultValue (LiteralStringImpl)
>> |
>> +- ...
>> +- value ("56")
>>
>> But with what method of "obj" I get the value "56" of the defaultValue?
>>
>> Thanks in advance and best regards
>> Tom
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03063 seconds