Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » hasXxx() instead of isXxx()
hasXxx() instead of isXxx() [message #424824] Thu, 06 November 2008 07:58 Go to next message
Christian Hauser is currently offline Christian HauserFriend
Messages: 189
Registered: July 2009
Senior Member
Hi EMF gurus

I'm wondering if it is possible to specify somehow within my model.ecore
or model.genmodel files whether a boolean flag creates a isXxx() or
hasXxx() method.

For example:
I create my model using the ecore/EMF model editor. There I create a
class Person and give it a boolean flag drivingLicense. Now I'd like to
have a Person#hasDrivingLicense() method to be created for the
drivingLicense flag instead of the default Person#isDrivingLicense() flag.

Is that possible and if so, which property do I have to set?

Thanks in advance for any help on this,
Christian
Re: hasXxx() instead of isXxx() [message #424826 is a reply to message #424824] Thu, 06 November 2008 10:04 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33142
Registered: July 2009
Senior Member
Christian,

Comments below.


Christian Hauser wrote:
> Hi EMF gurus
>
> I'm wondering if it is possible to specify somehow within my
> model.ecore or model.genmodel files whether a boolean flag creates a
> isXxx() or hasXxx() method.
No, just as there is no way to specify get/set/isSet/unset.
>
> For example:
> I create my model using the ecore/EMF model editor. There I create a
> class Person and give it a boolean flag drivingLicense. Now I'd like
> to have a Person#hasDrivingLicense() method to be created for the
> drivingLicense flag instead of the default Person#isDrivingLicense()
> flag.
>
> Is that possible and if so, which property do I have to set?
You could suppress the "getter" from the generated API using an
EAnnotation as specified by EcoreUtil.setSuppressedVisibility and define
an EOperation with the name you want and with a body annotation that's
just "return isDrivingLicense".
>
> Thanks in advance for any help on this,
> Christian


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: hasXxx() instead of isXxx() [message #424834 is a reply to message #424826] Thu, 06 November 2008 12:44 Go to previous message
Christian Hauser is currently offline Christian HauserFriend
Messages: 189
Registered: July 2009
Senior Member
Thanks Ed for your help.


Ed Merks wrote:
> Christian,
>
> Comments below.
>
>
> Christian Hauser wrote:
>> Hi EMF gurus
>>
>> I'm wondering if it is possible to specify somehow within my
>> model.ecore or model.genmodel files whether a boolean flag creates a
>> isXxx() or hasXxx() method.
> No, just as there is no way to specify get/set/isSet/unset.
>>
>> For example:
>> I create my model using the ecore/EMF model editor. There I create a
>> class Person and give it a boolean flag drivingLicense. Now I'd like
>> to have a Person#hasDrivingLicense() method to be created for the
>> drivingLicense flag instead of the default Person#isDrivingLicense()
>> flag.
>>
>> Is that possible and if so, which property do I have to set?
> You could suppress the "getter" from the generated API using an
> EAnnotation as specified by EcoreUtil.setSuppressedVisibility and define
> an EOperation with the name you want and with a body annotation that's
> just "return isDrivingLicense".
>>
>> Thanks in advance for any help on this,
>> Christian
Previous Topic:Listener for all EMF based models
Next Topic:Invalid thread access
Goto Forum:
  


Current Time: Fri Apr 26 20:34:18 GMT 2024

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

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

Back to the top