Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » Accessing EMF model EEnum isSetX() in template
Accessing EMF model EEnum isSetX() in template [message #31779] Tue, 28 August 2007 17:08 Go to next message
Francis Gavino is currently offline Francis GavinoFriend
Messages: 57
Registered: July 2009
Member
Hi,

Is it possible (aside from creating a custom jet tag or xpath function) to
access/call/retrieve the value of the ESet property or isSetX() method of
an EObject that has an EAttribute X of type EEnum? In my ecore, I already
have Unsettable to true, and I want to determine in the JET template
whether the attribute was set or unset.

Thanks,
Francis
Re: Accessing EMF model EEnum isSetX() in template [message #31990 is a reply to message #31779] Wed, 29 August 2007 13:09 Go to previous messageGo to next message
Paul Elder is currently offline Paul ElderFriend
Messages: 849
Registered: July 2009
Senior Member
Francis:

JET's XPath engine respects eIstSet(), and if this returns false, XPath
expressions referencing attribute should behave as if the attribute is not
there. So, the following should work to test if you attribute is set or
not...

<c:if test="$yourEObject/@yourEAttributeName" >
... done if yourEObject.getYourEAttributeName().eIsSet() is true ...
</c:if>

<c:if test="not( $yourEObject/@yourEAttributeName )" >
... done if yourEObject.getYourEAttributeName().eIsSet() is false ...
</c:if>

Paul

"Francis" <fgavino@gmail.com> wrote in message
news:9546a35a1bc555f8163223b0d74e1d88$1@www.eclipse.org...
> Hi,
>
> Is it possible (aside from creating a custom jet tag or xpath function) to
> access/call/retrieve the value of the ESet property or isSetX() method of
> an EObject that has an EAttribute X of type EEnum? In my ecore, I already
> have Unsettable to true, and I want to determine in the JET template
> whether the attribute was set or unset.
>
> Thanks,
> Francis
>
>
Re: Accessing EMF model EEnum isSetX() in template [message #32060 is a reply to message #31990] Wed, 29 August 2007 17:09 Go to previous message
Francis Gavino is currently offline Francis GavinoFriend
Messages: 57
Registered: July 2009
Member
Thanks Paul, this will save me a lot of time. I thought it was different
for enums, but I should have tried it first :-)

Paul Elder wrote:

> Francis:

> JET's XPath engine respects eIstSet(), and if this returns false, XPath
> expressions referencing attribute should behave as if the attribute is not
> there. So, the following should work to test if you attribute is set or
> not...

> <c:if test="$yourEObject/@yourEAttributeName" >
> ... done if yourEObject.getYourEAttributeName().eIsSet() is true ...
> </c:if>

> <c:if test="not( $yourEObject/@yourEAttributeName )" >
> ... done if yourEObject.getYourEAttributeName().eIsSet() is false ...
> </c:if>

> Paul
Previous Topic:XML output merging
Next Topic:UML2 Sequence Diagrams
Goto Forum:
  


Current Time: Fri Apr 26 17:49:06 GMT 2024

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

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

Back to the top