Class FallbackableTypeFactory
- java.lang.Object
-
- com.fasterxml.jackson.databind.type.TypeFactory
-
- org.kie.server.api.marshalling.json.FallbackableTypeFactory
-
- All Implemented Interfaces:
Serializable
public class FallbackableTypeFactory extends com.fasterxml.jackson.databind.type.TypeFactory- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected ClassLoaderfallbackClassLoaderprotected static FallbackableTypeFactoryinstance
-
Constructor Summary
Constructors Modifier Constructor Description protectedFallbackableTypeFactory(com.fasterxml.jackson.databind.util.LookupCache<Object,com.fasterxml.jackson.databind.JavaType> typeCache)protectedFallbackableTypeFactory(com.fasterxml.jackson.databind.util.LookupCache<Object,com.fasterxml.jackson.databind.JavaType> typeCache, com.fasterxml.jackson.databind.type.TypeParser p, com.fasterxml.jackson.databind.type.TypeModifier[] mods, ClassLoader classLoader)protectedFallbackableTypeFactory(com.fasterxml.jackson.databind.util.LookupCache<Object,com.fasterxml.jackson.databind.JavaType> typeCache, com.fasterxml.jackson.databind.type.TypeParser p, com.fasterxml.jackson.databind.type.TypeModifier[] mods, ClassLoader classLoader, ClassLoader fallbackClassLoader)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static FallbackableTypeFactorydefaultInstance()Class<?>findClass(String className)If TypeFactory.findClass() cannot find a Class, try with fallback classloader.ClassLoadergetFallbackClassLoader()FallbackableTypeFactorywithCache(com.fasterxml.jackson.databind.util.LookupCache<Object,com.fasterxml.jackson.databind.JavaType> cache)Mutant factory method that will construct newTypeFactorywith identical settings except for different cache; most likely one with bigger maximum size.FallbackableTypeFactorywithClassLoader(ClassLoader classLoader)"Mutant factory" method which will construct a new instance with specifiedClassLoaderto use byfindClass(java.lang.String).FallbackableTypeFactorywithFallbackClassLoader(ClassLoader fallbackClassLoader)"Mutant factory" method which will construct a new instance with specified fallbackClassLoaderto use byfindClass(java.lang.String)only when main classloader or thread context classloader can not resolve.FallbackableTypeFactorywithModifier(com.fasterxml.jackson.databind.type.TypeModifier mod)"Mutant factory" method which will construct a new instance with specifiedTypeModifieradded as the first modifier to call (in case there are multiple registered).-
Methods inherited from class com.fasterxml.jackson.databind.type.TypeFactory
_applyModifiers, _constructSimple, _findPrimitive, _findWellKnownSimple, _fromAny, _fromArrayType, _fromClass, _fromParamType, _fromVariable, _fromWellKnownClass, _fromWellKnownInterface, _fromWildcard, _newSimpleType, _resolveSuperClass, _resolveSuperInterfaces, _unknownType, classForName, classForName, clearCache, constructArrayType, constructArrayType, constructCollectionLikeType, constructCollectionLikeType, constructCollectionType, constructCollectionType, constructFromCanonical, constructGeneralizedType, constructMapLikeType, constructMapLikeType, constructMapType, constructMapType, constructParametricType, constructParametricType, constructParametricType, constructParametrizedType, constructParametrizedType, constructRawCollectionLikeType, constructRawCollectionType, constructRawMapLikeType, constructRawMapType, constructReferenceType, constructSimpleType, constructSimpleType, constructSpecializedType, constructSpecializedType, constructType, constructType, constructType, constructType, constructType, findTypeParameters, findTypeParameters, findTypeParameters, getClassLoader, moreSpecificType, rawClass, resolveMemberType, uncheckedSimpleType, unknownType, withCache
-
-
-
-
Field Detail
-
fallbackClassLoader
protected final transient ClassLoader fallbackClassLoader
-
instance
protected static final FallbackableTypeFactory instance
-
-
Constructor Detail
-
FallbackableTypeFactory
protected FallbackableTypeFactory(com.fasterxml.jackson.databind.util.LookupCache<Object,com.fasterxml.jackson.databind.JavaType> typeCache)
-
FallbackableTypeFactory
protected FallbackableTypeFactory(com.fasterxml.jackson.databind.util.LookupCache<Object,com.fasterxml.jackson.databind.JavaType> typeCache, com.fasterxml.jackson.databind.type.TypeParser p, com.fasterxml.jackson.databind.type.TypeModifier[] mods, ClassLoader classLoader)
-
FallbackableTypeFactory
protected FallbackableTypeFactory(com.fasterxml.jackson.databind.util.LookupCache<Object,com.fasterxml.jackson.databind.JavaType> typeCache, com.fasterxml.jackson.databind.type.TypeParser p, com.fasterxml.jackson.databind.type.TypeModifier[] mods, ClassLoader classLoader, ClassLoader fallbackClassLoader)
-
-
Method Detail
-
withFallbackClassLoader
public FallbackableTypeFactory withFallbackClassLoader(ClassLoader fallbackClassLoader)
"Mutant factory" method which will construct a new instance with specified fallbackClassLoaderto use byfindClass(java.lang.String)only when main classloader or thread context classloader can not resolve.
-
withModifier
public FallbackableTypeFactory withModifier(com.fasterxml.jackson.databind.type.TypeModifier mod)
"Mutant factory" method which will construct a new instance with specifiedTypeModifieradded as the first modifier to call (in case there are multiple registered).- Overrides:
withModifierin classcom.fasterxml.jackson.databind.type.TypeFactory
-
withClassLoader
public FallbackableTypeFactory withClassLoader(ClassLoader classLoader)
"Mutant factory" method which will construct a new instance with specifiedClassLoaderto use byfindClass(java.lang.String).- Overrides:
withClassLoaderin classcom.fasterxml.jackson.databind.type.TypeFactory
-
withCache
public FallbackableTypeFactory withCache(com.fasterxml.jackson.databind.util.LookupCache<Object,com.fasterxml.jackson.databind.JavaType> cache)
Mutant factory method that will construct newTypeFactorywith identical settings except for different cache; most likely one with bigger maximum size.- Overrides:
withCachein classcom.fasterxml.jackson.databind.type.TypeFactory- Since:
- 2.12
-
defaultInstance
public static FallbackableTypeFactory defaultInstance()
-
getFallbackClassLoader
public ClassLoader getFallbackClassLoader()
-
findClass
public Class<?> findClass(String className) throws ClassNotFoundException
If TypeFactory.findClass() cannot find a Class, try with fallback classloader. Main use case: Thread context classloader is KieURLClassLoader (dependency jar) but @class attribute (generated by @JsonTypeInfo(use = Id.CLASS)) may refers to a Class which exists in a different jar/kjar so ProjectClassLoader (or client application classloader) could be a fallback classloader- Overrides:
findClassin classcom.fasterxml.jackson.databind.type.TypeFactory- Throws:
ClassNotFoundException
-
-