Repository: zest-java
Updated Branches:
  refs/heads/develop d313c1329 -> dc30f4b41


runtime: refine TypeLookup


Project: http://git-wip-us.apache.org/repos/asf/zest-java/repo
Commit: http://git-wip-us.apache.org/repos/asf/zest-java/commit/ebe9f8c7
Tree: http://git-wip-us.apache.org/repos/asf/zest-java/tree/ebe9f8c7
Diff: http://git-wip-us.apache.org/repos/asf/zest-java/diff/ebe9f8c7

Branch: refs/heads/develop
Commit: ebe9f8c7f2e4d4d540c8dbe57cb78d86b1cc92a8
Parents: d313c13
Author: Paul Merlin <[email protected]>
Authored: Mon Nov 28 17:20:51 2016 +0100
Committer: Paul Merlin <[email protected]>
Committed: Mon Nov 28 17:20:51 2016 +0100

----------------------------------------------------------------------
 .../zest/runtime/structure/TypeLookupImpl.java    | 18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zest-java/blob/ebe9f8c7/core/runtime/src/main/java/org/apache/zest/runtime/structure/TypeLookupImpl.java
----------------------------------------------------------------------
diff --git 
a/core/runtime/src/main/java/org/apache/zest/runtime/structure/TypeLookupImpl.java
 
b/core/runtime/src/main/java/org/apache/zest/runtime/structure/TypeLookupImpl.java
index f9cc137..f3e8a4e 100644
--- 
a/core/runtime/src/main/java/org/apache/zest/runtime/structure/TypeLookupImpl.java
+++ 
b/core/runtime/src/main/java/org/apache/zest/runtime/structure/TypeLookupImpl.java
@@ -50,11 +50,6 @@ import static org.apache.zest.api.util.Classes.interfacesOf;
 class TypeLookupImpl
     implements TypeLookup
 {
-
-    // Constructor parameters
-    private final ModuleDescriptor moduleModel;
-
-    // Eager instance objects
     private final LazyValue<List<ObjectDescriptor>> allObjects;
     private final LazyValue<List<TransientDescriptor>> allTransients;
     private final LazyValue<List<ValueDescriptor>> allValues;
@@ -63,11 +58,13 @@ class TypeLookupImpl
     private final ConcurrentHashMap<Class<?>, ObjectDescriptor> objectModels;
     private final ConcurrentHashMap<Class<?>, TransientDescriptor> 
transientModels;
     private final ConcurrentHashMap<Class<?>, ValueDescriptor> valueModels;
-    private final ConcurrentHashMap<Class<?>, List<EntityDescriptor>> 
allEntityModels;
+    private final ConcurrentHashMap<Class<?>, List<EntityDescriptor>> 
entityModels;
     private final ConcurrentHashMap<Class<?>, EntityDescriptor> 
unambiguousEntityModels;
     private final ConcurrentHashMap<Type, ModelDescriptor> serviceModels;
     private final ConcurrentHashMap<Type, List<? extends ModelDescriptor>> 
servicesReferences;
 
+    private final ModuleDescriptor moduleModel;
+
     /**
      * Create a new TypeLookup bound to the given moduleModel.
      *
@@ -75,10 +72,9 @@ class TypeLookupImpl
      */
     TypeLookupImpl( ModuleModel module )
     {
-        // Constructor parameters
-        this.moduleModel = module;
+        moduleModel = module;
 
-        // Eager instance objects
+        // Instance caches
         allObjects = new LazyValue<>();
         allTransients = new LazyValue<>();
         allValues = new LazyValue<>();
@@ -87,7 +83,7 @@ class TypeLookupImpl
         objectModels = new ConcurrentHashMap<>();
         transientModels = new ConcurrentHashMap<>();
         valueModels = new ConcurrentHashMap<>();
-        allEntityModels = new ConcurrentHashMap<>();
+        entityModels = new ConcurrentHashMap<>();
         unambiguousEntityModels = new ConcurrentHashMap<>();
         serviceModels = new ConcurrentHashMap<>();
         servicesReferences = new ConcurrentHashMap<>();
@@ -241,7 +237,7 @@ class TypeLookupImpl
     @Override
     public List<EntityDescriptor> lookupEntityModels( final Class type )
     {
-        return allEntityModels.computeIfAbsent( type, key ->
+        return entityModels.computeIfAbsent( type, key ->
             concat(
                 allEntities().filter( ref -> new ExactTypeMatching<>( key 
).test( ref ) ),
                 allEntities().filter( ref -> new AssignableFromTypeMatching<>( 
key ).test( ref ) )

Reply via email to