Mirco
Mirco

Reputation: 3016

JAXB how to marshall ArrayList<ArrayList<Object>>

I got an attribute like this

private ArrayList<ArrayList<Vector3D>>    trajectories = new ArrayList<ArrayList<Vector3D>>();

Vector3D is a simple container for 3 double values. How do I marshall this properly with JAXB? I only get elements in the XML-File.

Upvotes: 1

Views: 259

Answers (1)

Ilya
Ilya

Reputation: 29663

1) Use

private ArrayList<ListOfVectors>    trajectories = new ArrayList<ListOfVectors>();  

instead of

private ArrayList<ArrayList<Vector3D>>    trajectories = new ArrayList<ArrayList<Vector3D>>();  

where ListOfVectors is

@XmlAccessorType(XmlAccessType.FIELD)
public class ListOfVectors 
{
   ArrayList<Vector3D> list = new ArrayList<Vector3D>();
} 

Upvotes: 1

Related Questions