public interface JaxbContextCache
JAXBContext instances per message type.
It is used to achieve better performance when marshalling or unmarshalling MX messages.
| Modifier and Type | Method and Description |
|---|---|
javax.xml.bind.JAXBContext |
get(java.lang.Class messageClass,
java.lang.Class<?>[] classes)
Returns the cached context to marshall or unmarshall a message.
|
javax.xml.bind.JAXBContext get(java.lang.Class messageClass,
java.lang.Class<?>[] classes)
throws javax.xml.bind.JAXBException,
java.util.concurrent.ExecutionException
Cache implementations should be per message type, so the actual message class name could be used as key.
Regarding the JAXBContext creation, notice the namespace or package cannot be used because all dictionary classes in the model share the same "dic" package.
The classes parameter is used to avoid reflection and improve performance. Can be used when the set of
jaxb generated classes for a specific model is known. This is the case for MX messages, where the set of classes
is available in the AbstractMX subclass. Thus when the classes array is received, the context can be created
directly with: JAXBContext.newInstance(classes). And the messageClass can be used as key.
When the classes parameter is not available, the context can be created with:
JAXBContext.newInstance(messageClass).
messageClass - class of the message to be read or written, cannot be nullclasses - comprehensive list of classes for the context, null or empty to create a context with the messageClassjavax.xml.bind.JAXBExceptionjava.util.concurrent.ExecutionException