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 Gavino
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 Elder
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 Gavino
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: Thu Oct 23 15:19:45 GMT 2014

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

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