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 ClassLoader
fallbackClassLoader
protected static FallbackableTypeFactory
instance
-
Constructor Summary
Constructors Modifier Constructor Description protected
FallbackableTypeFactory(com.fasterxml.jackson.databind.util.LookupCache<Object,com.fasterxml.jackson.databind.JavaType> typeCache)
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)
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 Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static FallbackableTypeFactory
defaultInstance()
Class<?>
findClass(String className)
If TypeFactory.findClass() cannot find a Class, try with fallback classloader.ClassLoader
getFallbackClassLoader()
FallbackableTypeFactory
withCache(com.fasterxml.jackson.databind.util.LookupCache<Object,com.fasterxml.jackson.databind.JavaType> cache)
Mutant factory method that will construct newTypeFactory
with identical settings except for different cache; most likely one with bigger maximum size.FallbackableTypeFactory
withClassLoader(ClassLoader classLoader)
"Mutant factory" method which will construct a new instance with specifiedClassLoader
to use byfindClass(java.lang.String)
.FallbackableTypeFactory
withFallbackClassLoader(ClassLoader fallbackClassLoader)
"Mutant factory" method which will construct a new instance with specified fallbackClassLoader
to use byfindClass(java.lang.String)
only when main classloader or thread context classloader can not resolve.FallbackableTypeFactory
withModifier(com.fasterxml.jackson.databind.type.TypeModifier mod)
"Mutant factory" method which will construct a new instance with specifiedTypeModifier
added 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 fallbackClassLoader
to 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 specifiedTypeModifier
added as the first modifier to call (in case there are multiple registered).- Overrides:
withModifier
in classcom.fasterxml.jackson.databind.type.TypeFactory
-
withClassLoader
public FallbackableTypeFactory withClassLoader(ClassLoader classLoader)
"Mutant factory" method which will construct a new instance with specifiedClassLoader
to use byfindClass(java.lang.String)
.- Overrides:
withClassLoader
in 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 newTypeFactory
with identical settings except for different cache; most likely one with bigger maximum size.- Overrides:
withCache
in 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:
findClass
in classcom.fasterxml.jackson.databind.type.TypeFactory
- Throws:
ClassNotFoundException
-
-