JAXB

There are 4 things you need to know about the SXC JAXB implementation:

  1. It is very fast. Around 2-3x faster than the JAXB RI.
  2. It does not pass the TCK (yet). This means we do not implement every piece of JAXB functionality. See below for more info.
  3. It depends on the JAXB RI. You should still use the RI XJC implementation and you'll need the RI on the classpath. You can think of sxc-jaxb as a new runtime for the RI.
  4. To enable it, you need to :
    • Download the "sxc-jaxb-VERSION-bundle.jar"
    • Add it to your project's classpath.
    • Ensure that the jar is BEFORE the JAXB-RI on your classpath.
    • Ensure that the jaxb-xjc jar (from the JAXB RI) is also on your classpath

What is not implemented?

  • Attachments
  • IDRefs
  • Support for custom ObjectFactorys
  • xs:anyType/anyAttribute support
  • Validation
  • Type adapters specified on the JAXBContext (Annotations should work for simple types at the very least)
  • possibly more

Performance

SXC achieves its performance by virtue of several things:
1. There is no reflection - data is set via setters, accessed via getters, and objects are constructed directly.
2. There is no code to match up the parser state and which objects/properties need to be set
3. All namespaces for writing are precomputed
4. All strings are interned ahead of time, ensuring that we can always do == comparisons when looking at element names.
5. It does the least amount of work possible to read or write your objects.

In our initial tests the JAXB implementation is 2-3x faster when reading and about 20-90% faster when writing when using StAX.

Labels

 
(None)