5

Is it possible to define global java type adapters/converters in MOXy (up to the newest release (2.6.0)?
Such adapter would be applied by default to all classes registered in jaxb context if not explicitly overridden.

For instance, I would like to add support for all Joda Time types which would require neither a @XmlJavaTypeAdapter at a field nor a class nor a package level.

Stepan Vavra
  • 3,884
  • 5
  • 29
  • 40

2 Answers2

3

As workaround it's possible to wrap all needed instances with some custom type:

public class MyJodaTime {
  @XmlValue    
  @XmlJavaTypeAdapter(JodaTimeAdapter.class)    
  public DateTime value;
}
yaroska
  • 375
  • 2
  • 5
3

Filed a bug for this.

https://bugs.eclipse.org/bugs/show_bug.cgi?id=478404

Workaround I currently use: Create OXM bindings configuration dynamically at runtime and save it in memory as a String. Then feed it to MOXy via "eclipselink.oxm.metadata-source" property, using StringReaders.

marcelv3612
  • 663
  • 4
  • 10