[apt-jelly-users] Can't get annotation values
Brought to you by:
stoicflame
|
From: Konan L. <kon...@gm...> - 2006-08-03 09:09:56
|
I'm using freemarker with Apt-Jelly, as a static generation tool. I'm
having many concerns, it's probably me ... but let's start with this
one.
I decorated a Java interface with an annotation of mine. I can use
several ways to get to the annotation itself, but can't get the
annotation values.
My annotation is
<<
package pack;
public @interface NEcMock
{
String myOption() default "optionMy";
}
>>
My annotated class is
<<
@pack.NEcMock( myOption = "newOption")
public interface IEcMockableSample extends IEcMarkerBean
{
}
>>
I want access to :
1. the annotation element : myOption() or myOption
2. its default value : "optionMy"
3. its value : "newOption"
I tried many things in the template, nothing works.
---- Freemarker example with Apt-Jelly
<@ifHasAnnotation var="annotationMirror" annotation=myAnnotation>
Has annotation mirror : ${annotationMirror.elementValues?size}
</@ifHasAnnotation>
It returns "Has annotation mirror : 0" !!
---- Freemarker-only example
Freemarker only : ${type.annotationMirrors[0].elementValues?size}
It returns "Freemarker only : 0" !!
I tried many other ways, all the ones I could think of in fact. I'm
dry right now ;-) !!!
The context part is taken care for me, because I use apt-jelly out of
the box, launched from the ant 1.7 task. I have no outside code that
could be faulty :-) !
Any help would be appreciated :-)
KLM
|