I do have the following annotation in a JAXB generated class
@XmlType(name = "MessageInfoType", propOrder = {
"debugTraceBoolean",
"clientHostnameString",
"endUserIPAddress"
})
Need to produce the following annotation in JAXB class with custom binding..i.e is need to edit the above annotation and add a namespace using annox as below type.
@XmlType(name = "MessageInfoType", propOrder = {
"debugTraceBoolean",
"clientHostnameString",
"endUserIPAddress"
}, namespace="urn:expedia:e3:data:messagetypes:defn:v4")
my xjb file is:
<jaxb:bindings schemaLocation="../../serviceDescription/atlantis/common/com.expedia.e3.data.messagetypes.v4.xsd">
<jaxb:bindings node="//xs:complexType[@name='MessageInfoType']">
<annox:annotate target="field">
<annox:annotate annox:class="javax.xml.bind.annotation.XmlType"
namespace="urn:expedia:e3:data:messagetypes:defn:v4"/>
</annox:annotate>
</jaxb:bindings>
</jaxb:bindings>
Affiliation disclaimer: I am the author of the Annotate Plugin.
If you try to add an annotation which already exists (same location, same annotation class), this will modify an existing annotation rather than add a second one. I am not sure at the moment, if this will override all the attributes or merge new ones, but it's definitely worth trying.
Update:
I've rechecked this. Indeed, it is implemented (should be of version 0.6.4, I've just checked with 0.6.5-SNAPSHOT).
Check this sample:
Here's the binding:
<jaxb:bindings node="xs:complexType[@name='issueJIIB39CType']/xs:attribute[@name='test']">
<annox:annotate target="field">
<annox:annotate annox:class="javax.xml.bind.annotation.XmlAttribute" required="false"/>
</annox:annotate>
</jaxb:bindings>
If this binding is present, you'll get:
@XmlAttribute(name = "test", required = false)
protected String test;
If not it will be like this:
@XmlAttribute(name = "test", required = true)
protected String test;
So, as I said if you add an annotation at the very same place and the very same class, they will be merged.