define getter of derived volatile attribute [message #1060723] |
Tue, 28 May 2013 08:55 |
|
Hi,
I have defined a derived volatile attribute. Now I need to implement the
getter. By default, the EMF generator creates a method stub, and I have
to manually implement the body. In order to avoid trouble in case of
re-generation (actually, I'm using an Xtext post processor to add the
derived attribute, so "@generate not" is not working), I would like to
define the body of the getter in the model, similar to the body of an
operation (which can to be defined in an annotation). Is that possible?
Actually, I would like to simply add the body in the post processing
step, when I define the attribute.
Regards,
Jens
|
|
|
Re: define getter of derived volatile attribute [message #1060765 is a reply to message #1060723] |
Tue, 28 May 2013 11:47 |
Ed Merks Messages: 33218 Registered: July 2009 |
Senior Member |
|
|
Jens,
The generator has methods like this
protected String getGetterBody()
{
EStructuralFeature eStructuralFeature = getEcoreFeature();
EAnnotation eAnnotation =
eStructuralFeature.getEAnnotation(GenModelPackage.eNS_URI);
return eAnnotation == null ? null :
(String)eAnnotation.getDetails().get("get");
}
that will extract the stub into the generated code.
On 28/05/2013 10:55 AM, Jens v.P. wrote:
> Hi,
>
> I have defined a derived volatile attribute. Now I need to implement
> the getter. By default, the EMF generator creates a method stub, and I
> have to manually implement the body. In order to avoid trouble in case
> of re-generation (actually, I'm using an Xtext post processor to add
> the derived attribute, so "@generate not" is not working), I would
> like to define the body of the getter in the model, similar to the
> body of an operation (which can to be defined in an annotation). Is
> that possible? Actually, I would like to simply add the body in the
> post processing step, when I define the attribute.
>
> Regards,
> Jens
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
|
Powered by
FUDForum. Page generated in 0.03590 seconds