By default a a JAXB (JSR-222) implementation will determine the class to unmarshal based on the root element. This is matched with metadata provided via an @XmlRootElement
or @XmlElementDecl
annotation.
Alternately you one of the unmarshal methods that take a class parameter. This tells JAXB what class you wish to unmarshal to. The result of the unmarshal will be an instance of JAXBElement
that in addition to the Java object will contain root element info in case you need it.
JAXBContext context = JAXBContext.newInstance(Transform.class);
Unmarshaller unmarshaller = context.createUnmarshaller();
Transform result = unmarshaller.unmarshal(v, Transform.class).getValue();