Package be.ehealth.technicalconnector.utils.impl

# Class JaxbContextFactory

java.lang.Object
be.ehealth.technicalconnector.utils.impl.JaxbContextFactory

public final class JaxbContextFactory extends Object
JaxbContextFactory.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static jakarta.xml.bind.JAXBContext`
  `getJaxbContextForClass(Class<?>... classesToBeBound)`
  `static jakarta.xml.bind.JAXBContext`
  `getJaxbContextForPackage(Package pack)`
  `static void`
  `initJaxbContext(Class<?>... classesToBeBound)`
  Create a JAXBContext with all the referenced classes in input.
  `static void`
  `initJaxbContext(Class<?> keyClass, boolean override, Class<?>... classesToBeBound)`
  Create a JAXBContext with all the referenced classes in classesToBeBound.
  `static void`
  `initJaxbContext(Package packageInstance)`
  Create a JAXBContext with all the classes in the provided `Package`.
  `static void`
  `reset()`
  Method to clear the cached instances.

  ### Methods inherited from class java.lang.Object

  `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Method Details

  - ### initJaxbContext

    public static void initJaxbContext(Package packageInstance)
    Create a JAXBContext with all the classes in the provided `Package`.
    Parameters:
      `packageInstance` -

  - ### initJaxbContext

    public static void initJaxbContext(Class<?> keyClass, boolean override, Class<?>... classesToBeBound)
    Create a JAXBContext with all the referenced classes in classesToBeBound. Using the keyClass as context identifier. The typical use case for this method is the explicit binding of custom derived types that are members of the root keyClass: this will ensure the derived type is used vs the parent type during marshalling/unmarshalling. The override parameter can be used to recreate the context, in order to ensure the JAXBContext associated to the keyClass is refreshed with the up-to-date classes to be bound.
    Parameters:
      `keyClass` - the context cache key
      `override` - true if the context must be refreshed in the cache, false otherwise
      `classesToBeBound` - the classes to be put in the jaxb context for the given keyClass

  - ### initJaxbContext

    public static void initJaxbContext(Class<?>... classesToBeBound)
    Create a JAXBContext with all the referenced classes in input.
    Parameters:
      `classesToBeBound` -

  - ### getJaxbContextForPackage

    public static jakarta.xml.bind.JAXBContext getJaxbContextForPackage(Package pack)

  - ### getJaxbContextForClass

    public static jakarta.xml.bind.JAXBContext getJaxbContextForClass(Class<?>... classesToBeBound) throws jakarta.xml.bind.JAXBException
    Throws:
      `jakarta.xml.bind.JAXBException`

  - ### reset

    public static void reset()
    Method to clear the cached instances.