users@jaxb.java.net

Re: how to get the annotations with the methods in stead of with the fields?

From: xtien <christine_at_christine.nl>
Date: Thu, 26 Nov 2009 07:21:31 -0800 (PST)

Wolfgang Laun-2 wrote:
>
> On Thu, Nov 26, 2009 at 2:34 PM, xtien <christine_at_christine.nl> wrote:
>>
>> The Jaxb Eclipse plugin generates @XmlElement annotations with the field
>> names. In my app, it would be more convenient to have the annotations
>> with
>> the getter.
>
> Why? Perhaps you post what you want to achieve.
>

Does it matter?

In my code at some point I have a getter method. The code invokes the method
on a class. With this invocation, the code needs the name of the element
that's in the information from the XmlElement. If the naming of methods and
fields were standard, I could simply get the annotation from the field by
creating the field name from the getter name and get the fields annotation.
However, the classes are genereated based on xml from a system that does not
conform to standard field names. I am not in control of that system. It's
hard to create a field name from a getter name, so that's why it would be
convenient to have the annotation with the getter.
Actually, all I want to do is retrieve the original element name in a piece
of code where I have the getter method but not the field that it goes with.

-- 
View this message in context: http://old.nabble.com/how-to-get-the-annotations-with-the-methods-in-stead-of-with-the-fields--tp26529506p26530937.html
Sent from the java.net - jaxb users mailing list archive at Nabble.com.