You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@juneau.apache.org by ja...@apache.org on 2017/02/04 19:22:20 UTC
incubator-juneau git commit: Performance improvement for Map and
Collection ClassMetas.
Repository: incubator-juneau
Updated Branches:
refs/heads/master 1bafbb4ed -> bdeb4f02c
Performance improvement for Map and Collection ClassMetas.
Project: http://git-wip-us.apache.org/repos/asf/incubator-juneau/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-juneau/commit/bdeb4f02
Tree: http://git-wip-us.apache.org/repos/asf/incubator-juneau/tree/bdeb4f02
Diff: http://git-wip-us.apache.org/repos/asf/incubator-juneau/diff/bdeb4f02
Branch: refs/heads/master
Commit: bdeb4f02ca8a7c21d479d552a5613eedffbbcda9
Parents: 1bafbb4
Author: JamesBognar <ja...@apache.org>
Authored: Sat Feb 4 14:22:17 2017 -0500
Committer: JamesBognar <ja...@apache.org>
Committed: Sat Feb 4 14:22:17 2017 -0500
----------------------------------------------------------------------
.../java/org/apache/juneau/BeanContext.java | 6 +--
.../main/java/org/apache/juneau/ClassMeta.java | 42 ++++++++++++++++++++
2 files changed, 45 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/bdeb4f02/juneau-core/src/main/java/org/apache/juneau/BeanContext.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/BeanContext.java b/juneau-core/src/main/java/org/apache/juneau/BeanContext.java
index 1a06ea4..7690729 100644
--- a/juneau-core/src/main/java/org/apache/juneau/BeanContext.java
+++ b/juneau-core/src/main/java/org/apache/juneau/BeanContext.java
@@ -1508,14 +1508,14 @@ public class BeanContext extends Context {
return rawType;
if (params[0].isObject() && params[1].isObject())
return rawType;
- return new ClassMeta(rawType.innerClass, this).setKeyType(params[0]).setValueType(params[1]);
+ return new ClassMeta(rawType, params[0], params[1], null);
}
if (rawType.isCollection()) {
if (params.length != 1)
return rawType;
if (params[0].isObject())
return rawType;
- return new ClassMeta(rawType.innerClass, this).setElementType(params[0]);
+ return new ClassMeta(rawType, null, null, params[0]);
}
}
@@ -1633,7 +1633,7 @@ public class BeanContext extends Context {
//
// This code is inherently unsafe (but still potentially useful?)
-//
+//
// /**
// * Converts class name strings to ClassMeta objects.
// *
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/bdeb4f02/juneau-core/src/main/java/org/apache/juneau/ClassMeta.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/ClassMeta.java b/juneau-core/src/main/java/org/apache/juneau/ClassMeta.java
index aff1f77..c36ffd8 100644
--- a/juneau-core/src/main/java/org/apache/juneau/ClassMeta.java
+++ b/juneau-core/src/main/java/org/apache/juneau/ClassMeta.java
@@ -373,6 +373,48 @@ public final class ClassMeta<T> implements Type {
init();
}
+ /**
+ * Copy constructor.
+ * Used for creating Map and Collection class metas that shouldn't be cached.
+ */
+ ClassMeta(ClassMeta<T> mainType, ClassMeta<?> keyType, ClassMeta<?> valueType, ClassMeta<?> elementType) {
+ this.innerClass = mainType.innerClass;
+ this.cc = mainType.cc;
+ this.fromStringMethod = mainType.fromStringMethod;
+ this.noArgConstructor = mainType.noArgConstructor;
+ this.stringConstructor = mainType.stringConstructor;
+ this.numberConstructor = mainType.numberConstructor;
+ this.swapConstructor = mainType.swapConstructor;
+ this.objectMapConstructor = mainType.objectMapConstructor;
+ this.swapMethodType = mainType.swapMethodType;
+ this.numberConstructorType = mainType.numberConstructorType;
+ this.toObjectMapMethod = mainType.toObjectMapMethod;
+ this.swapMethod = mainType.swapMethod;
+ this.namePropertyMethod = mainType.namePropertyMethod;
+ this.parentPropertyMethod = mainType.parentPropertyMethod;
+ this.isDelegate = mainType.isDelegate;
+ this.isAbstract = mainType.isAbstract;
+ this.isMemberClass = mainType.isMemberClass;
+ this.primitiveDefault = mainType.primitiveDefault;
+ this.remoteableMethods = mainType.remoteableMethods;
+ this.publicMethods = mainType.publicMethods;
+ this.beanContext = mainType.beanContext;
+ this.serializedClassMeta = this;
+ this.elementType = elementType;
+ this.keyType = keyType;
+ this.valueType = valueType;
+ this.invocationHandler = mainType.invocationHandler;
+ this.beanMeta = mainType.beanMeta;
+ this.dictionaryName = mainType.dictionaryName;
+ this.resolvedDictionaryName = mainType.resolvedDictionaryName;
+ this.notABeanReason = mainType.notABeanReason;
+ this.pojoSwap = mainType.pojoSwap;
+ this.beanFilter = mainType.beanFilter;
+ this.extMeta = mainType.extMeta;
+ this.initException = mainType.initException;
+ this.hasChildPojoSwaps = mainType.hasChildPojoSwaps;
+ }
+
@SuppressWarnings({ "unchecked", "rawtypes" })
ClassMeta init() {