|
|
|
Re: infer annotation with key-value Pairs [message #1434728 is a reply to message #1434541] |
Tue, 30 September 2014 13:47 |
Sebastian Zarnekow Messages: 3118 Registered: July 2009 |
Senior Member |
|
|
Hi Tobias,
please set the explicitValues of your annotation reference rather than
values. #values provides a view that contains the explicit values and
the default values if no explicit values have been given.
Best,
Sebastian
--
Looking for professional support for Xtext, Xtend or Eclipse Modeling?
Go visit: http://xtext.itemis.com
Am 30.09.14 14:30, schrieb Tobias Wink:
> Hi,
>
> I'm new here and still at the beginning of learning Xtext and Xtend.
>
> As mentioned in the topic I'm currently trying to infer an annotation
> with a key-value Pair like the JPA Annotation @Table(name="TABLE_NAME")
>
> I've found and adapted the solution from
> https://www.eclipse.org/forums/index.php/t/486005/:
>
> def addStringValues(JvmAnnotationReference annoRef, String name,
> String... newValues) {
> val op = annoRef.findOperationByName(name)
> annoRef.values += createJvmStringAnnotationValue => [
> operation = op
> values += newValues
> ]
> annoRef
> }
>
> My problem is, that by annoRef.values
> JvmAnnotationReferenceImplCustom.getValues() is called and returns a
> ECollections.unmodifiableEList so I get an Exception when trying to add
> a new value.
>
> I've found out, that it's from type JvmAnnotationReferenceImplCustom
> because createJvmAnnotationReference in
> org.eclipse.xtext.common.types.impl.TypesFactoryImpl is:
>
> public JvmAnnotationReference createJvmAnnotationReference()
> {
> JvmAnnotationReferenceImplCustom jvmAnnotationReference = new
> JvmAnnotationReferenceImplCustom();
> return jvmAnnotationReference;
> }
>
> What are my possibilities to get around with it so I can infer those
> annotations?
|
|
|
|
Powered by
FUDForum. Page generated in 0.01900 seconds