Improvements to ClassMeta class. Project: http://git-wip-us.apache.org/repos/asf/incubator-juneau/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-juneau/commit/96cf56b4 Tree: http://git-wip-us.apache.org/repos/asf/incubator-juneau/tree/96cf56b4 Diff: http://git-wip-us.apache.org/repos/asf/incubator-juneau/diff/96cf56b4
Branch: refs/heads/master Commit: 96cf56b4aa448d34b86aa96631d65886db241b2a Parents: 062d7dd Author: JamesBognar <[email protected]> Authored: Sat Feb 4 17:49:42 2017 -0500 Committer: JamesBognar <[email protected]> Committed: Sat Feb 4 17:49:42 2017 -0500 ---------------------------------------------------------------------- .../main/java/org/apache/juneau/ClassMeta.java | 35 ++++---------------- 1 file changed, 6 insertions(+), 29 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/96cf56b4/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 5e079c4..586d0b5 100644 --- a/juneau-core/src/main/java/org/apache/juneau/ClassMeta.java +++ b/juneau-core/src/main/java/org/apache/juneau/ClassMeta.java @@ -88,6 +88,11 @@ public final class ClassMeta<T> implements Type { final ConcurrentHashMap<Class<?>,PojoSwap<?,?>> childSwapMap, // Maps normal subclasses to PojoSwaps. childUnswapMap; // Maps swap subclasses to PojoSwaps. + final PojoSwap<T,?> pojoSwap; // The object POJO swap associated with this bean (if it has one). + final BeanFilter beanFilter; // The bean filter associated with this bean (if it has one). + + private final MetadataMap extMeta; // Extended metadata + final BeanContext beanContext; // The bean context that created this object. ClassMeta<?> @@ -99,10 +104,6 @@ public final class ClassMeta<T> implements Type { BeanMeta<T> beanMeta; // The bean meta for this bean class (if it's a bean). String dictionaryName, resolvedDictionaryName; // The dictionary name of this class if it has one. String notABeanReason; // If this isn't a bean, the reason why. - PojoSwap<T,?> pojoSwap; // The object POJO swap associated with this bean (if it has one). - BeanFilter beanFilter; // The bean filter associated with this bean (if it has one). - - private MetadataMap extMeta = new MetadataMap(); // Extended metadata private Throwable initException; // Any exceptions thrown in the init() method. private static final Boolean BOOLEAN_DEFAULT = false; @@ -422,6 +423,7 @@ public final class ClassMeta<T> implements Type { this.remoteableMethods = _remoteableMethods; this.beanFilter = beanFilter; this.pojoSwap = ps; + this.extMeta = new MetadataMap(); if (! delayedInit) init(); @@ -477,31 +479,6 @@ public final class ClassMeta<T> implements Type { try { - Class c = innerClass; - - if (swapMethod != null) { - this.pojoSwap = new PojoSwap<T,Object>(c, swapMethod.getReturnType()) { - @Override - public Object swap(BeanSession session, Object o) throws SerializeException { - try { - return swapMethod.invoke(o, session); - } catch (Exception e) { - throw new SerializeException(e); - } - } - @Override - public T unswap(BeanSession session, Object f, ClassMeta<?> hint) throws ParseException { - try { - if (swapConstructor != null) - return swapConstructor.newInstance(f); - return super.unswap(session, f, hint); - } catch (Exception e) { - throw new ParseException(e); - } - } - }; - } - serializedClassMeta = (pojoSwap == null ? this : findClassMeta(pojoSwap.getSwapClass())); if (serializedClassMeta == null) serializedClassMeta = this;
