From 44e93326856bf6545378518ee86a3e9ff127f452 Mon Sep 17 00:00:00 2001 From: zhouping Date: Thu, 20 Dec 2018 18:09:09 +0800 Subject: [PATCH] =?UTF-8?q?rt=20=E8=AF=AF=E5=88=A0=E4=BA=86=E5=AE=9A?= =?UTF-8?q?=E5=88=B6=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../jackson/databind/type/ClassFactory.java | 11 +++++++++++ .../jackson/databind/type/TypeFactory.java | 14 ++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 fine-jackson/src/com/fr/third/fasterxml/jackson/databind/type/ClassFactory.java diff --git a/fine-jackson/src/com/fr/third/fasterxml/jackson/databind/type/ClassFactory.java b/fine-jackson/src/com/fr/third/fasterxml/jackson/databind/type/ClassFactory.java new file mode 100644 index 000000000..3b8183486 --- /dev/null +++ b/fine-jackson/src/com/fr/third/fasterxml/jackson/databind/type/ClassFactory.java @@ -0,0 +1,11 @@ +package com.fr.third.fasterxml.jackson.databind.type; + +/** + * Created by juhaoyu on 2018/11/5. + */ +public interface ClassFactory { + + Class classForName(String className); + + Class classForName(String className, ClassLoader classLoader); +} \ No newline at end of file diff --git a/fine-jackson/src/com/fr/third/fasterxml/jackson/databind/type/TypeFactory.java b/fine-jackson/src/com/fr/third/fasterxml/jackson/databind/type/TypeFactory.java index 1978466a9..9d9455cb6 100644 --- a/fine-jackson/src/com/fr/third/fasterxml/jackson/databind/type/TypeFactory.java +++ b/fine-jackson/src/com/fr/third/fasterxml/jackson/databind/type/TypeFactory.java @@ -138,12 +138,19 @@ public final class TypeFactory */ protected final ClassLoader _classLoader; + private ClassFactory classFactory; + /* /********************************************************** /* Life-cycle /********************************************************** */ + public void setClassFactory(ClassFactory classFactory) { + + this.classFactory = classFactory; + } + private TypeFactory() { _parser = new TypeParser(this); _modifiers = null; @@ -278,10 +285,17 @@ public final class TypeFactory protected Class classForName(String name, boolean initialize, ClassLoader loader) throws ClassNotFoundException { + if (classFactory != null) { + return classFactory.classForName(name, loader); + } return Class.forName(name, true, loader); } protected Class classForName(String name) throws ClassNotFoundException { + + if (classFactory != null) { + return classFactory.classForName(name); + } return Class.forName(name); }