JAXB unmarshalling using @ xmljavatypeadapters
I have three classes
@XmlRootElement public class GeofenceParameter{ private GeofenceCenterAddress geofenceCenterAddress; private GeofenceCenterCoordinates geofenceCenterCoordinates; } public class GeofenceCenterAddress extends GeofenceParameter{ } public class GeofenceCenterCoordinate extends GeofenceParameter{ }
I have made two different xmladapter extension classes to group and ungroup geofence parameters in geofencecenteraddress and geofencecentercoordinate
Class forGeofenceCenterCoordinate extends XmlAdapter<ValueType,BoundType>{ } Class forGeofenceCenterAddress extends XmlAdapter<ValueType,BoundType>{ }
Send according to the soap request and obtain the instance of the relevant geofencecenteraddress or geofencecentercoordinate class from the geofenceparameter
For this, I'm at package info The annotation @ xmljavatypeadapters {(@ xmljavatypeadapter (type = forgeofencecentercoordinate)), @ xmljavatypeadapter (type = forgeofencecenteraddress)} is used in the java file
However, in the web service, it will give me an instance of a class. I specified this class in the annotation, that is, @ xmljavatypeadapter (type = forgeofencecentercoordinate) class, instead of @ xmljavatypeadapter (type = forgeofencecenteraddress) from geofenceparameter
Can you help me modify the instance of the second class in JAXB inheritance grouping and ungrouping
Thank you in advance
Solution
I don't remember using @ xmljavatypeadapters, but the normal usage of @ xmljavatypeadapter annotation is @ xmljavatypeadapter (forgeofencecentercoordinate. Class)
The type parameter is required only if the annotation is applied at the package level