How to change programmatically the default JAXB date serialization?

Viewed 19697

Is there a way to change the default way jaxb serialize/deserialize types, dates in my case, without specifying it through annotation and/or through xml jaxb binding as mentioned here http://jaxb.java.net/guide/Using_different_datatypes.html

I'd basically like to do something like:

    JAXBContext jaxbContext = ...;
    Marshaller marshaller = jaxbContext.createMarshaller().setAdapter(new DateAdapter(dateFormat));

To have a preconfigured JaxBContext or Marshaller/Unmarshaller that serialize/deserialize dates in a customized way..

Couldn't find any resource that shows how to do expect through annotations or statically with the xml binding file.. Thanks!

3 Answers
Related