I’m using JAXB 2.2 and I’m into some trouble.
I have the following XML in my xsd:
<xs:complexType name="Party" abstract="true">
<xs:annotation>
<xs:appinfo>
<ci:code>
public ElectronicAddress
getFirstPrimaryElectronicAddressPhone() {
for (ElectronicAddress
eAddress : electronicAddresses) {
if (checkRefCodeTypeCode(eAddress,
CodeHelper.ADDRTYPEELECORG_PHONE_CODE,
CodeHelper.ADDRTYPEELECPERS_PHONE_CODE)) {
return eAddress;
}
}
return
null;
}
[...]
Now, I need to import my own (CodeHelper) class into the generated class, because CodeHelper is not in the same package as the generated source.
Is there any possibility to do that?
Thanks!
You could possibly write an XJC plugin to get this behaviour. The link below has some pointers for creating a plugin:
The example in the above article is actually a code injector plug-in.