propertyGetter.invoke [message #14453] |
Wed, 25 March 2009 15:07  |
Eclipse User |
|
|
|
Hi,
I am using EOL and I am trying to get the values of a set of properties of
a specific model element. The properties are in a Sequence.
I use the following EOL code:
for (i in self) {
Model.propertyGetter.invoke(modElement, i.name);
}
This seems to work fine for undefined properties and properties that
return one model element. I noticed that I get a NullPointerException for
the property that returns more than one element. I guess the problems lies
with evoke() which returns an Object instead of a Set!?
Is there a workaround for the problem or am I making a mistake?
Thanks a lot in advance and regards,
Anne
|
|
|
|
|
|
|
Re: propertyGetter.invoke [message #566119 is a reply to message #14453] |
Thu, 26 March 2009 11:38  |
Eclipse User |
|
|
|
Hi Anne,
That's quite creative! I've never thought that someone would use this in
that way :) (Another alternative would be to call the eGet method:
modElement.eGet(modElement.eClass().getEStructuralFeature(i. name));)
Regarding the error, I've tried with both single and multi-valued
properties but I can't seem to be able to reproduce this. Would it be
possible to share a minimal working example (eol + ecore + sample model)
that demonstrates this - obviously unwanted - behaviour?
Cheers,
Dimitris
Anne Keller wrote:
> Hi,
>
> I am using EOL and I am trying to get the values of a set of properties
> of a specific model element. The properties are in a Sequence.
>
> I use the following EOL code:
>
> for (i in self) {
> Model.propertyGetter.invoke(modElement, i.name);
> }
>
> This seems to work fine for undefined properties and properties that
> return one model element. I noticed that I get a NullPointerException
> for the property that returns more than one element. I guess the
> problems lies with evoke() which returns an Object instead of a Set!?
>
> Is there a workaround for the problem or am I making a mistake?
>
> Thanks a lot in advance and regards,
> Anne
>
|
|
|
Re: propertyGetter.invoke [message #566135 is a reply to message #14485] |
Fri, 27 March 2009 06:27  |
Eclipse User |
|
|
|
Hi Dimitri,
thanks a lot for the help! Using
modElement.eGet(modElement.eClass().getEStructuralFeature(i. name));
works like a charm.
I will get an example with the error to you shortly.
Thanks again and regards,
Anne
|
|
|
Re: propertyGetter.invoke [message #566250 is a reply to message #14515] |
Mon, 30 March 2009 06:59  |
Eclipse User |
|
|
|
Hi Anne,
Thanks a lot for isolating the problem and sending me the example! I
just had a look into this and found/fixed a nasty bug (which you most
probably don't want to know more about :) ). I've committed the changes
to the SVN and uploaded a new binary version (0.8.4.200903301146) in the
interim update site
(http://download.eclipse.org/modeling/gmt/epsilon/interim/).
The new version also includes a new epsilon.emf.loadRegisteredMetamodel
task which allows you to load metamodels from the EMF EPackage registry.
In your case, you can use it to replace:
<epsilon.loadModel name="UML_model" type="EMF">
<parameter name="modelFile" value="${basedir}/UML.ecore"/>
<parameter name="metamodelFile" value="${basedir}/CMOF.ecore"/>
<parameter name="isMetamodelFileBased" value="true"/>
<parameter name="readOnLoad" value="true"/>
<parameter name="storeOnDisposal" value="false"/>
<parameter name="aliases" value="UML"/>
</epsilon.loadModel>
with:
<epsilon.emf.loadRegisteredMetamodel name="UML_model" aliases="UML"
metamodeluri="http://www.eclipse.org/uml2/2.1.0/UML"/>
and save the time needed to read UML.ecore from the filesystem.
Cheers,
Dimitris
Anne Keller wrote:
> Hi Dimitri,
>
> thanks a lot for the help! Using
>
> modElement.eGet(modElement.eClass().getEStructuralFeature(i. name));
>
> works like a charm.
>
> I will get an example with the error to you shortly.
>
> Thanks again and regards,
> Anne
>
>
|
|
|
|
Powered by
FUDForum. Page generated in 0.11734 seconds