Skip to main content

@XmlJavaTypeAdapters working?

1 reply [Last post]
Joined: 2004-12-20

I have a file containing :
@javax.xml.bind.annotation.adapters.XmlJavaTypeAdapters({@javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter(value=CustomNotificationAdapter.class, type=CustomNotification.class)})

When I serialize a CustomNotification object, the associated Adapter is never called.

What am I missing.



Adapter class
public class CustomNotificationAdapter extends XmlAdapter {

/** Creates a new instance of NotificationAdapter */
public CustomNotificationAdapter() {


public CustomNotification unmarshal(JAXBCustomNotificationType v) throws Exception {
System.out.println("In Adapter Unmarshal");
return new CustomNotification(null);

public JAXBCustomNotificationType marshal(CustomNotification v) throws Exception {
System.out.println("In Adapter Marshal");
JAXBCustomNotificationType customBean = new JAXBCustomNotificationType();
return customBean;

JAXB bound type

@XmlType(name = "JAXBCustomNotification")
public class JAXBCustomNotificationType extends NotificationType {

private String value;
* Creates a new instance of JAXBCustomNotificationType
public JAXBCustomNotificationType() {

public void setMyCustomExtension(String value) {
this.value = value;

public String getMyCustomExtension() {
return value;

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2003-06-25

Please file an issue at against this problem.