Package com.helger.jaxb
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_VALUESFields inherited from class com.helger.commons.cache.MappedCache
m_aRWLock, NO_MAX_SIZE, STATISTICS_PREFIX -
Method Summary
Modifier and TypeMethodDescriptionjakarta.xml.bind.JAXBContextgetFromCache(com.helger.commons.collection.impl.ICommonsList<Class<?>> aClasses) Deprecated, for removal: This API element is subject to removal in a future version.jakarta.xml.bind.JAXBContextgetFromCache(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 theJAXBContextCacheKeyfactory methods insteadjakarta.xml.bind.JAXBContextgetFromCache(Class<?> aClass) Deprecated, for removal: This API element is subject to removal in a future version.Use theJAXBContextCacheKeyfactory methods insteadjakarta.xml.bind.JAXBContextgetFromCache(Class<?> aClass, ClassLoader aClassLoader) Deprecated, for removal: This API element is subject to removal in a future version.Use theJAXBContextCacheKeyfactory methods insteadjakarta.xml.bind.JAXBContextgetFromCache(Package aPackage) Deprecated, for removal: This API element is subject to removal in a future version.Use theJAXBContextCacheKeyfactory methods insteadjakarta.xml.bind.JAXBContextgetFromCache(Package aPackage, ClassLoader aClassLoader) Deprecated, for removal: This API element is subject to removal in a future version.Use theJAXBContextCacheKeyfactory methods insteadstatic JAXBContextCachestatic booleanstatic booleancom.helger.commons.state.EChangeremoveFromCache(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.EChangeremoveFromCache(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.EChangeremoveFromCache(Package aPackage) Deprecated, for removal: This API element is subject to removal in a future version.com.helger.commons.state.EChangeremoveFromCache(Package aPackage, ClassLoader aClassLoader) Deprecated, for removal: This API element is subject to removal in a future version.static booleansetSilentMode(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
-
Method Details
-
isSilentMode
public static boolean isSilentMode()- Returns:
trueif logging is disabled,falseif it is enabled.- Since:
- 9.4.0
-
setSilentMode
public static boolean setSilentMode(boolean bSilentMode) Enable or disable certain regular log messages.- Parameters:
bSilentMode-trueto disable logging,falseto enable logging- Returns:
- The previous value of the silent mode.
- Since:
- 9.4.0
-
isInstantiated
public static boolean isInstantiated() -
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 theJAXBContextCacheKeyfactory methods insteadSpecial overload with package and defaultClassLoader.- Parameters:
aPackage- Package to load. May not benull.- Returns:
nullif package isnull.
-
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 theJAXBContextCacheKeyfactory methods insteadSpecial overload with package andClassLoader. In this case the resulting value is NOT cached!- Parameters:
aPackage- Package to load. May not benull.aClassLoader- Class loader to use. May benullin which case the default class loader is used.- Returns:
nullif package isnull.
-
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 theJAXBContextCacheKeyfactory methods insteadGet theJAXBContextfrom an existingClassobject. If the class's owning package is a valid JAXB package, this method redirects togetFromCache(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 benull.- 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 theJAXBContextCacheKeyfactory methods insteadGet theJAXBContextfrom an existingClassobject. If the class's owning package is a valid JAXB package, this method redirects togetFromCache(Package).- Parameters:
aClass- The class for which the JAXB context is to be created. May not benull.aClassLoader- Class loader to use. May benullin 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 theJAXBContextCacheKeyfactory methods insteadGet theJAXBContextfrom existingClassobjects.- Parameters:
aClasses- The classes for which the JAXB context is to be created. May not benullnor 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 theJAXBContextCacheKeyfactory methods insteadGet theJAXBContextfrom existingClassobjects and optional JAXB Context properties.- Parameters:
aClasses- The classes for which the JAXB context is to be created. May not benullnor empty.aProperties- JAXB context properties. May benull.- 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.
-
JAXBContextCacheKeyfactory methods instead