I have the following problem:
I have two generated classes that have only 1 difference. The version-number in the namespace (http://www.sample.com/soap/xsd/
2/ia
).
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "sampleType", namespace = "http://www.sample.com/soap/xsd/2/ia", propOrder = {
"decision"})
public class SampleType {
protected boolean isChecked;
//getter & setter
}
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "sampleType", namespace = "http://www.sample.com/soap/xsd/3/ia", propOrder = {
"decision"})
public class SampleType {
protected boolean isChecked;
//getter & setter
}
project structure:
com.sample.myapp
|
|_ v2
| |_ SampleType.class
|
|_ v3
|_ SampleType.class
com.sample.myOtherApp
|
|_ FlagChecker.class
caller class:
@Service("com.sample.myOtherApp.FlagChecker")
public class FlagChecker {
public Boolean isChecked(SampleType sample){
return sample.isChecked();
}
}
What I tried:
In the case my
Sample.class
would be a POJO I'd simply make anInterface
and use it in the signature of myisChecked()
-method. This is not possible becauseSample.class
are generated from a xsd or I don't know how to add the interface. I use JAXB to generate the java-classes. Manually adding is no option.I tried to use generics but it feels like I'm off the path.
Question: Is it possible to inject an interface in the jaxb-class-generation-process or is it possible to achieve what I want with generics or is there another straight forward solution?
EDIT:
The solution mentioned by @Erwin Boldwit pointing to this answer would be awesome but I get my xsd's from thirdparty and it is generally a bad idea to alter xsd's isn't it? There is no need to alter the xsd. The xjb is in a second file. I refused the linked answer before because I thought it needs alteration of the basefile.