In the application I am developing, we decided we wanted to add
validation logic to the classes generated by JAXB when using WSDL to
Java data binding.  However, we decided to keep the validation logic in
a sub-class of the JAXB generated object.  So for example, this is the
JAXB generated class:

 

@XmlAccessorType(XmlAccessType.FIELD)

@XmlType(name = "Email", propOrder = {

    "value"

})

public class EmailBase {

 

    @XmlValue

    protected String value;

 

    //Removed getters and setters

}

 

And this is the subclass:

 

@XmlAccessorType(XmlAccessType.FIELD)

@XmlType(name = "Email", propOrder = {

    "value"

})

public class Email extends EmailBase implements DataObjectBase

{

 

    public boolean validate()

    {

      //validation logic

    }

 

}

 

Now, when our Web Service receives a Request message with the Email
parameter, we'd like CXF/JAXB to unmarshall the parameter to a subclass
object, rather than the base class.  Is there a way to configure CXF or
JAXB to do so?

 

Reply via email to