Class JAXBContextCache

java.lang.Object
com.helger.commons.cache.MappedCache<KEYTYPE,KEYTYPE,VALUETYPE>
com.helger.commons.cache.Cache<JAXBContextCacheKey,jakarta.xml.bind.JAXBContext>
com.helger.jaxb.JAXBContextCache
All Implemented Interfaces:
com.helger.commons.cache.ICache<JAXBContextCacheKey,jakarta.xml.bind.JAXBContext>, com.helger.commons.cache.IMutableCache<JAXBContextCacheKey,jakarta.xml.bind.JAXBContext>, com.helger.commons.lang.IHasSize, com.helger.commons.log.IHasConditionalLogger, com.helger.commons.name.IHasName

@ThreadSafe @Singleton public final class JAXBContextCache extends com.helger.commons.cache.Cache<JAXBContextCacheKey,jakarta.xml.bind.JAXBContext> implements com.helger.commons.log.IHasConditionalLogger
Specific cache class for JAXB context elements. This is helpful, as the JAXB context creation is a very time consuming task.
Author:
Philip Helger
  • Field Summary

    Fields inherited from class com.helger.commons.cache.Cache

    DEFAULT_ALLOW_NULL_VALUES

    Fields inherited from class com.helger.commons.cache.MappedCache

    m_aRWLock, NO_MAX_SIZE, STATISTICS_PREFIX
  • Method Summary

    Modifier and Type
    Method
    Description
    jakarta.xml.bind.JAXBContext
    getFromCache(com.helger.commons.collection.impl.ICommonsList<Class<?>> aClasses)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Use the JAXBContextCacheKey factory methods instead
    jakarta.xml.bind.JAXBContext
    getFromCache(com.helger.commons.collection.impl.ICommonsList<Class<?>> aClasses, Map<String,?> aProperties)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Use the JAXBContextCacheKey factory methods instead
    jakarta.xml.bind.JAXBContext
    getFromCache(Class<?> aClass)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Use the JAXBContextCacheKey factory methods instead
    jakarta.xml.bind.JAXBContext
    getFromCache(Class<?> aClass, ClassLoader aClassLoader)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Use the JAXBContextCacheKey factory methods instead
    jakarta.xml.bind.JAXBContext
    Deprecated, for removal: This API element is subject to removal in a future version.
    Use the JAXBContextCacheKey factory methods instead
    jakarta.xml.bind.JAXBContext
    getFromCache(Package aPackage, ClassLoader aClassLoader)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Use the JAXBContextCacheKey factory methods instead
     
    static boolean
     
    static boolean
     
    com.helger.commons.state.EChange
    removeFromCache(com.helger.commons.collection.impl.ICommonsList<Class<?>> aClasses)
    Deprecated, for removal: This API element is subject to removal in a future version.
    com.helger.commons.state.EChange
    removeFromCache(com.helger.commons.collection.impl.ICommonsList<Class<?>> aClasses, Map<String,?> aProperties)
    Deprecated, for removal: This API element is subject to removal in a future version.
    com.helger.commons.state.EChange
    Deprecated, for removal: This API element is subject to removal in a future version.
    com.helger.commons.state.EChange
    removeFromCache(Package aPackage, ClassLoader aClassLoader)
    Deprecated, for removal: This API element is subject to removal in a future version.
    static boolean
    setSilentMode(boolean bSilentMode)
    Enable or disable certain regular log messages.

    Methods inherited from class com.helger.commons.cache.MappedCache

    clearCache, createCache, getCacheKeyProvider, getFromCache, getFromCacheNoStats, getFromCacheNoStatsNotLocked, getMaxSize, getName, getValueProvider, hasMaxSize, isAllowNullValues, isEmpty, isInCache, isNotEmpty, putInCache, putInCacheNotLocked, removeFromCache, size, toString

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Method Details

    • isSilentMode

      public static boolean isSilentMode()
      Returns:
      true if logging is disabled, false if it is enabled.
      Since:
      9.4.0
    • setSilentMode

      public static boolean setSilentMode(boolean bSilentMode)
      Enable or disable certain regular log messages.
      Parameters:
      bSilentMode - true to disable logging, false to enable logging
      Returns:
      The previous value of the silent mode.
      Since:
      9.4.0
    • isInstantiated

      public static boolean isInstantiated()
    • getInstance

      @Nonnull public static JAXBContextCache getInstance()
    • getFromCache

      @Nullable @Deprecated(forRemoval=true, since="11.0.4") public jakarta.xml.bind.JAXBContext getFromCache(@Nonnull Package aPackage)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Use the JAXBContextCacheKey factory methods instead
      Special overload with package and default ClassLoader.
      Parameters:
      aPackage - Package to load. May not be null.
      Returns:
      null if package is null.
    • getFromCache

      @Nullable @Deprecated(forRemoval=true, since="11.0.4") public jakarta.xml.bind.JAXBContext getFromCache(@Nonnull Package aPackage, @Nullable ClassLoader aClassLoader)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Use the JAXBContextCacheKey factory methods instead
      Special overload with package and ClassLoader. In this case the resulting value is NOT cached!
      Parameters:
      aPackage - Package to load. May not be null.
      aClassLoader - Class loader to use. May be null in which case the default class loader is used.
      Returns:
      null if package is null.
    • getFromCache

      @Nullable @Deprecated(forRemoval=true, since="11.0.4") public jakarta.xml.bind.JAXBContext getFromCache(@Nonnull Class<?> aClass)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Use the JAXBContextCacheKey factory methods instead
      Get the JAXBContext from an existing Class object. If the class's owning package is a valid JAXB package, this method redirects to getFromCache(Package) otherwise a new JAXB context is created and NOT cached.
      Parameters:
      aClass - The class for which the JAXB context is to be created. May not be null.
      Returns:
      May be null.
    • getFromCache

      @Nullable @Deprecated(forRemoval=true, since="11.0.4") public jakarta.xml.bind.JAXBContext getFromCache(@Nonnull Class<?> aClass, @Nullable ClassLoader aClassLoader)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Use the JAXBContextCacheKey factory methods instead
      Get the JAXBContext from an existing Class object. If the class's owning package is a valid JAXB package, this method redirects to getFromCache(Package).
      Parameters:
      aClass - The class for which the JAXB context is to be created. May not be null.
      aClassLoader - Class loader to use. May be null in which case the default class loader is used.
      Returns:
      May be null.
    • getFromCache

      @Nullable @Deprecated(forRemoval=true, since="11.0.4") public jakarta.xml.bind.JAXBContext getFromCache(@Nonnull com.helger.commons.collection.impl.ICommonsList<Class<?>> aClasses)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Use the JAXBContextCacheKey factory methods instead
      Get the JAXBContext from existing Class objects.
      Parameters:
      aClasses - The classes for which the JAXB context is to be created. May not be null nor empty.
      Returns:
      May be null.
      Since:
      v9.4.2
    • getFromCache

      @Nullable @Deprecated(forRemoval=true, since="11.0.4") public jakarta.xml.bind.JAXBContext getFromCache(@Nonnull com.helger.commons.collection.impl.ICommonsList<Class<?>> aClasses, @Nullable Map<String,?> aProperties)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Use the JAXBContextCacheKey factory methods instead
      Get the JAXBContext from existing Class objects and optional JAXB Context properties.
      Parameters:
      aClasses - The classes for which the JAXB context is to be created. May not be null nor empty.
      aProperties - JAXB context properties. May be null.
      Returns:
      May be null.
      Since:
      v9.4.2
    • removeFromCache

      @Nonnull @Deprecated(forRemoval=true, since="11.0.4") public com.helger.commons.state.EChange removeFromCache(@Nonnull Package aPackage)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • removeFromCache

      @Nonnull @Deprecated(forRemoval=true, since="11.0.4") public com.helger.commons.state.EChange removeFromCache(@Nonnull Package aPackage, @Nullable ClassLoader aClassLoader)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • removeFromCache

      @Nonnull @Deprecated(forRemoval=true, since="11.0.4") public com.helger.commons.state.EChange removeFromCache(@Nonnull com.helger.commons.collection.impl.ICommonsList<Class<?>> aClasses)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • removeFromCache

      @Nonnull @Deprecated(forRemoval=true, since="11.0.4") public com.helger.commons.state.EChange removeFromCache(@Nonnull com.helger.commons.collection.impl.ICommonsList<Class<?>> aClasses, @Nullable Map<String,?> aProperties)
      Deprecated, for removal: This API element is subject to removal in a future version.