users@jaxb.java.net

determine the type of elements in a list property

From: Hunor Bartha <hunor.bartha_at_ambo.ro>
Date: Wed, 20 Jun 2007 10:30:29 +0300

Hello everybody,

it seems that my jaxb-reflection related questions are rather unpopular
around here, but i give it a try again. I have a jaxb mapped class that
contains a property that is a list (corresponds to an element with
maxOccurs="unbounded"). My question is that if I want to add elements to
this list at runtime, is there a way to determine the type of elements
that this contains? My code is implemented in such way to be able to
handle any jaxb mapped object so I don't have the name of the methods,
or any specific jaxb object related information hard-coded (but i do
have the jaxb2-reflection library ;)). I need the type of the elements
in the list to be able to create new instances of that type.

Thanks,

hunor