users@jaxb.java.net

Re: CodeModel and nested annotations

From: jaki <jackie_james_at_infosys.com>
Date: Wed, 11 Jun 2008 02:32:05 -0700 (PDT)

My thread got hijacked it seems :-(:-(
Anyways, while on the question of annotations, is there anyway you can
change the name of an @XmlElement at runtime. In other words, is there a way
you can assign a string value to the 'name' attribute of @XmlElement?


Kenny MacLeod wrote:
>
> Ah, that's the one. I never could get my head around that API style :)
>
> cheers fella.
>
>
> Aleksei Valikov wrote:
>> Hi.
>>
>>> Morning folks,
>>>
>>> I'm trying to figure out how to set up nested annotations using the XJC
>>> CodeModel.
>>>
>>> For example, I want to generate this sort of thing:
>>>
>>> @X({
>>> @Y(a="b"),
>>> @Y(c="d")
>>> })
>>> public class C {}
>>>
>>> Once I've added the @X (using JAnnotatable.annotate), the returned
>>> JAnnotationUse object doesn't seem to offer a way of adding the @Y
>>> array, it
>>> only offers methods to add scalar parameters.
>>>
>>> What am I missing?
>>
>> Try something like:
>>
>> final JAnnotationArrayMember ys = myAnnotationUse.paramArray("value");
>> ys.annotate(Y.class).param("a", "b");
>> ys.annotate(Y.class).param("c", "d");
>>
>> Also see annox.dev.java.net and the annotate plugin in jaxb2-commons.
>>
>> Bye.
>> /lexi
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
>> For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
> For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>
>
>

-- 
View this message in context: http://www.nabble.com/HashMaps-and-Jaxb2-tp17770776p17773616.html
Sent from the java.net - jaxb users mailing list archive at Nabble.com.