Hello,
I have a class which is like
@XmlAccessorType( XmlAccessType.PUBLIC_MEMBER )
public class Airport
{
...
private List<Flight> flights;
...
@XmlElementWrapper(name="flightList")
@XmlElement(name="flight})
private List<Flight> flights;
...
public List<Flight> getFlights()
{
return flights;
}
public void setFlights(List<Flight> flights)
{
this.flights = flights;
}
}
and I am getting a class has two properties of the same name about the
getFlights() method and the flights variable. The interesting problem I am
having is in my GUI code when I call getFlights() method I have the class
has two properties of the same name error. If I change my code to look like
public class Airport
{
...
private List<Flight> flights;
...
@XmlElementWrapper(name="flightList")
@XmlElement(name="flight})
private List<Flight> flights;
...
public List<Flight> getFlights()
{
return flights;
}
public void setFlights(List<Flight> flights)
{
this.flights = flights;
}
}
Everything seams to work fine but the getFlights() will always return
an empty list. My flight class looks like
@XmlRootElement
public class Flight
{
...
}
I don't understand what I am doing wrong when trying to my Airport
object via a Jersey GET request and either I don't get a list of flights or
I get a class has two properties of the same name exception.
Thank you,
--
Eric Reagan