Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » Multi Java Annotations in the model (Java Annotations in the model )
Multi Java Annotations in the model [message #986398] Tue, 20 November 2012 10:30 Go to next message
gabriele boldrin is currently offline gabriele boldrin
Messages: 19
Registered: December 2009
Junior Member
I've specified in the model a java annotation.
If I insert more than one java annotation for node, TEXO considers only the first java annotation and the others are ignored.


Example:

index.php/fa/12445/0/

Generation Code:

	
        /**
	 * Returns the value of '<em><b>field2</b></em>' feature.
	 * 
	 * <!-- begin-user-doc --> <!-- end-user-doc -->
	 * 
	 * @return the value of '<em><b>field2</b></em>' feature
	 * @generated
	 */
	@Overview(Overview.DATE)
	public String getField2() {
		return field2;
	}


code generation that I expect:

	
        /**
	 * Returns the value of '<em><b>field2</b></em>' feature.
	 * 
	 * <!-- begin-user-doc --> <!-- end-user-doc -->
	 * 
	 * @return the value of '<em><b>field2</b></em>' feature
	 * @generated
	 */
	@Overview(Overview.DATE)
	@Overview(Overview.TEXT)
	public String getField2() {
		return field2;
	}
Re: Multi Java Annotations in the model [message #986406 is a reply to message #986398] Tue, 20 November 2012 10:42 Go to previous messageGo to next message
Martin Taal is currently offline Martin Taal
Messages: 5339
Registered: July 2009
Senior Member
Hi Gabriele,
The content of the eannotation is a large text field, so you can put them all in one eannotation, that will work.

But it is probably no work to add support for this, can you enter a bugzilla for this?

gr. Martin

On 11/20/2012 11:30 AM, gabriele boldrin wrote:
> I've specified in the model a java annotation.
> If I insert more than one java annotation for node, TEXO considers only the first java annotation and the others are ignored.
>
>
> Example:
>
>
>
> Generation Code:
>
>
>
> /**
> * Returns the value of '<em><b>field2</b></em>' feature.
> *
> * <!-- begin-user-doc --> <!-- end-user-doc -->
> *
> * @return the value of '<em><b>field2</b></em>' feature
> * @generated
> */
> @Overview(Overview.DATE)
> public String getField2() {
> return field2;
> }
>
>
> code generation that I expect:
>
>
>
> /**
> * Returns the value of '<em><b>field2</b></em>' feature.
> *
> * <!-- begin-user-doc --> <!-- end-user-doc -->
> *
> * @return the value of '<em><b>field2</b></em>' feature
> * @generated
> */
> @Overview(Overview.DATE)
> @Overview(Overview.TEXT)
> public String getField2() {
> return field2;
> }
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@xxxxxxxx - mtaal@xxxxxxxx
Web: www.springsite.com - www.elver.org
Re: Multi Java Annotations in the model [message #991125 is a reply to message #986406] Mon, 17 December 2012 12:26 Go to previous messageGo to next message
Andreas Brieg is currently offline Andreas Brieg
Messages: 48
Registered: November 2012
Member
As a side node: the Java code you want to be generated won't be valid. You can't annotate something with the same annotation type more than once. You would need something like
@Overviews(@Overview(Overview.Date), @Overview(Overview.Text))

or
@Overview({Overview.Date, Overview.Text})
Re: Multi Java Annotations in the model [message #991128 is a reply to message #991125] Mon, 17 December 2012 12:38 Go to previous messageGo to next message
Erdal Karaca is currently offline Erdal Karaca
Messages: 748
Registered: July 2009
Senior Member
Andreas Brieg wrote on Mon, 17 December 2012 13:26
As a side node: the Java code you want to be generated won't be valid. You can't annotate something with the same annotation type more than once. You would need something like
@Overviews(@Overview(Overview.Date), @Overview(Overview.Text))

or
@Overview({Overview.Date, Overview.Text})


It is the second one as you can only have one optional value/attribute in a java annotation...

[Updated on: Mon, 17 December 2012 12:39]

Report message to a moderator

Re: Multi Java Annotations in the model [message #991131 is a reply to message #991128] Mon, 17 December 2012 12:45 Go to previous messageGo to next message
Martin Taal is currently offline Martin Taal
Messages: 5339
Registered: July 2009
Senior Member
Hi Andreas,
Not sure which annotation/annotation type do you mean, is it related to Texo or to something else?

gr. Martin

On 12/17/2012 01:38 PM, Erdal Karaca wrote:
> Andreas Brieg wrote on Mon, 17 December 2012 13:26
>> As a side node: the Java code you want to be generated won't be valid. You can't annotate something with the same
>> annotation type more than once. You would need something like
>>
>> @Overviews(@Overview(Overview.Date), @Overview(Overview.Text))
>>
>> or
>>
>> @Overview({Overview.Date, Overview.Text})
>
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@xxxxxxxx - mtaal@xxxxxxxx
Web: www.springsite.com - www.elver.org
Re: Multi Java Annotations in the model [message #991138 is a reply to message #991131] Mon, 17 December 2012 13:15 Go to previous message
Martin Taal is currently offline Martin Taal
Messages: 5339
Registered: July 2009
Senior Member
Ha Andreas,
Forget my question, I see now that you refer to (the invalid example in) the original question.

gr. Martin

On 12/17/2012 01:45 PM, Martin Taal wrote:
> Hi Andreas,
> Not sure which annotation/annotation type do you mean, is it related to Texo or to something else?
>
> gr. Martin
>
> On 12/17/2012 01:38 PM, Erdal Karaca wrote:
>> Andreas Brieg wrote on Mon, 17 December 2012 13:26
>>> As a side node: the Java code you want to be generated won't be valid. You can't annotate something with the same
>>> annotation type more than once. You would need something like
>>>
>>> @Overviews(@Overview(Overview.Date), @Overview(Overview.Text))
>>>
>>> or
>>>
>>> @Overview({Overview.Date, Overview.Text})
>>
>>
>
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@xxxxxxxx - mtaal@xxxxxxxx
Web: www.springsite.com - www.elver.org
Previous Topic:NPE When Serializing with Texo
Next Topic:EMF + Texo + Xpand2
Goto Forum:
  


Current Time: Mon Oct 20 13:16:59 GMT 2014

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

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