From 3cfcbfccf26ac700d7dd77b677ec22a5f8a23c66 Mon Sep 17 00:00:00 2001 From: ju Date: Mon, 5 Nov 2018 19:56:28 +0800 Subject: [PATCH] fix --- fine-druid/fine-druid.iml | 13 ------------- fine-hibernate/fine-hibernate.iml | 18 ------------------ .../jackson/databind/type/ClassFactory.java | 11 +++++++++++ .../jackson/databind/type/TypeFactory.java | 18 +++++++++++++++++- 4 files changed, 28 insertions(+), 32 deletions(-) delete mode 100644 fine-druid/fine-druid.iml delete mode 100644 fine-hibernate/fine-hibernate.iml create mode 100644 fine-jackson/src/com/fr/third/fasterxml/jackson/databind/type/ClassFactory.java diff --git a/fine-druid/fine-druid.iml b/fine-druid/fine-druid.iml deleted file mode 100644 index 3ed349c5f..000000000 --- a/fine-druid/fine-druid.iml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/fine-hibernate/fine-hibernate.iml b/fine-hibernate/fine-hibernate.iml deleted file mode 100644 index 34472121c..000000000 --- a/fine-hibernate/fine-hibernate.iml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - - - \ No newline at end of file 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..5daecf195 --- /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); +} 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 44a02d4de..98f6163d8 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 @@ -103,13 +103,21 @@ public final class TypeFactory * ClassLoader used by this factory (Issue #624) */ 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; @@ -247,10 +255,18 @@ 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); }