Class 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  
      • Fields inherited from class com.fasterxml.jackson.databind.type.TypeFactory

        _classLoader, _modifiers, _parser, _typeCache, CORE_TYPE_BOOL, CORE_TYPE_CLASS, CORE_TYPE_COMPARABLE, CORE_TYPE_ENUM, CORE_TYPE_INT, CORE_TYPE_JSON_NODE, CORE_TYPE_LONG, CORE_TYPE_OBJECT, CORE_TYPE_STRING, EMPTY_BINDINGS
    • 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 new TypeFactory 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 specified ClassLoader to use by findClass(java.lang.String).
      FallbackableTypeFactory withFallbackClassLoader​(ClassLoader fallbackClassLoader)
      "Mutant factory" method which will construct a new instance with specified fallback ClassLoader to use by findClass(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 specified TypeModifier 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
    • 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

      • withModifier

        public FallbackableTypeFactory withModifier​(com.fasterxml.jackson.databind.type.TypeModifier mod)
        "Mutant factory" method which will construct a new instance with specified TypeModifier added as the first modifier to call (in case there are multiple registered).
        Overrides:
        withModifier in class com.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 new TypeFactory with identical settings except for different cache; most likely one with bigger maximum size.
        Overrides:
        withCache in class com.fasterxml.jackson.databind.type.TypeFactory
        Since:
        2.12
      • 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 class com.fasterxml.jackson.databind.type.TypeFactory
        Throws:
        ClassNotFoundException