I have the following class, i want to be able to produce xml dynamically based ona an interface, with changing implementations... is that possible... i have tried with little luck...
@xmlRootElement
public class Vehicles {
   private String id;
   private List<VehicleType> types;
   .... various setters and getters...
   ... with annotated getters...
}
public interface VehicleType {
   public String getName();
}
public Car implements VehicleType {
    private String name;
    private String wheels;
    ...various constructors...
    @XmlElement
    public String getName() {
      return name;
    }
    @XmlElement
    public String getWheels() {
      return wheels;
    }
 }
public Motorbike implements VehicleType {
    private String name;
    private String exhaust;
    ...various constructors...
    @XmlElement
    public String getName() {
      return name;
    }
    @XmlElement
    public String getExhaust() {
      return exhaust;
    }
 }
I want the marshlling of Vehicles to produce the following output:
<vehicles>
   <types>
     <car>
        ..car specific elements
     </car>
     <motorbike>
        .. mototrbike specific elements
     <motorbike>
   </types>
</vehicles> 
The vehicles class cannot know about the implementations, or which ones exist.. it only knows about the interface, which here im using as a marker interface really.. to allow me to populate a list with different implementations at runtime...
Is there anyway i can get jaxb be to render the output as xml with out the parent really knowing about the implementations?