polygene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nic...@apache.org
Subject [20/34] zest-java git commit: ZEST-136 - Massive changes to the Runtime, refactoring the Model and Instance relationship.
Date Thu, 14 Apr 2016 06:13:26 GMT
http://git-wip-us.apache.org/repos/asf/zest-java/blob/dedb068e/core/runtime/src/test/java/org/apache/zest/runtime/value/ValueEqualityTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/zest/runtime/value/ValueEqualityTest.java b/core/runtime/src/test/java/org/apache/zest/runtime/value/ValueEqualityTest.java
index aaa8662..3a1b6f4 100644
--- a/core/runtime/src/test/java/org/apache/zest/runtime/value/ValueEqualityTest.java
+++ b/core/runtime/src/test/java/org/apache/zest/runtime/value/ValueEqualityTest.java
@@ -61,10 +61,10 @@ public class ValueEqualityTest
     @Test
     public void givenValuesOfTheSameTypeWhenTestingValueDescriptorEqualityExpectEquals()
     {
-        Some some = buildSomeValue( module );
+        Some some = buildSomeValue(valueBuilderFactory);
         ValueDescriptor someDescriptor = zest.api().valueDescriptorFor( some );
 
-        Some other = buildSomeValue( module );
+        Some other = buildSomeValue( valueBuilderFactory );
         ValueDescriptor otherDescriptor = zest.api().valueDescriptorFor( other );
 
         assertThat( "ValueDescriptors equal",
@@ -78,10 +78,10 @@ public class ValueEqualityTest
     @Test
     public void givenValuesOfCommonTypesWhenTestingValueDescriptorEqualityExpectNotEquals()
     {
-        Some some = buildSomeValue( module );
+        Some some = buildSomeValue( valueBuilderFactory );
         ValueDescriptor someDescriptor = zest.api().valueDescriptorFor( some );
 
-        PrimitivesValue primitive = buildPrimitivesValue( module );
+        PrimitivesValue primitive = buildPrimitivesValue( valueBuilderFactory );
         ValueDescriptor primitiveDescriptor = zest.api().valueDescriptorFor( primitive );
 
         assertThat( "ValueDescriptors not equal",
@@ -95,10 +95,10 @@ public class ValueEqualityTest
     @Test
     public void givenValuesOfDifferentTypesWhenTestingValueDescriptorEqualityExpectNotEquals()
     {
-        Some some = buildSomeValue( module );
+        Some some = buildSomeValue( valueBuilderFactory );
         ValueDescriptor someDescriptor = zest.api().valueDescriptorFor( some );
 
-        Other other = buildOtherValue( module );
+        Other other = buildOtherValue( valueBuilderFactory );
         ValueDescriptor otherDescriptor = zest.api().valueDescriptorFor( other );
 
         assertThat( "ValueDescriptors not equal",
@@ -115,10 +115,10 @@ public class ValueEqualityTest
     @Test
     public void givenValuesOfSameTypesAndSameStateWhenTestingValueStateEqualityExpectEquals()
     {
-        Some some = buildSomeValue( module );
+        Some some = buildSomeValue( valueBuilderFactory );
         AssociationStateHolder someState = zest.spi().stateOf( (ValueComposite) some );
 
-        Some some2 = buildSomeValue( module );
+        Some some2 = buildSomeValue( valueBuilderFactory );
         AssociationStateHolder some2State = zest.spi().stateOf( (ValueComposite) some2 );
 
         assertThat( "ValueStates equal",
@@ -132,10 +132,10 @@ public class ValueEqualityTest
     @Test
     public void givenValuesOfSameTypesAndDifferentStateWhenTestingValueStateEqualityExpectNotEquals()
     {
-        Some some = buildSomeValue( module );
+        Some some = buildSomeValue( valueBuilderFactory );
         AssociationStateHolder someState = zest.spi().stateOf( (ValueComposite) some );
 
-        Some some2 = buildSomeValueWithDifferentState( module );
+        Some some2 = buildSomeValueWithDifferentState( valueBuilderFactory );
         AssociationStateHolder some2State = zest.spi().stateOf( (ValueComposite) some2 );
 
         assertThat( "ValueStates not equal",
@@ -149,10 +149,10 @@ public class ValueEqualityTest
     @Test
     public void givenValuesOfDifferentTypesAndSameStateWhenTestingValueStateEqualityExpectEquals()
     {
-        Some some = buildSomeValue( module );
+        Some some = buildSomeValue( valueBuilderFactory );
         AssociationStateHolder someState = zest.spi().stateOf( (ValueComposite) some );
 
-        AnotherSome anotherSome = buildAnotherSomeValue( module );
+        AnotherSome anotherSome = buildAnotherSomeValue( valueBuilderFactory );
         AssociationStateHolder anotherSomeState = zest.spi().stateOf( (ValueComposite) anotherSome );
 
         assertThat( "ValueStates equal",
@@ -166,10 +166,10 @@ public class ValueEqualityTest
     @Test
     public void givenValuesOfDifferentTypesAndDifferentStateWhenTestingValueStateEqualityExpectNotEquals()
     {
-        Some some = buildSomeValue( module );
+        Some some = buildSomeValue( valueBuilderFactory );
         AssociationStateHolder someState = zest.spi().stateOf( (ValueComposite) some );
 
-        AnotherSome anotherSome = buildAnotherSomeValueWithDifferentState( module );
+        AnotherSome anotherSome = buildAnotherSomeValueWithDifferentState( valueBuilderFactory );
         AssociationStateHolder anotherSomeState = zest.spi().stateOf( (ValueComposite) anotherSome );
 
         assertThat( "ValueStates not equal",
@@ -186,8 +186,8 @@ public class ValueEqualityTest
     @Test
     public void givenValuesOfSameTypesAndSameStateWhenTestingValueEqualityExpectEquals()
     {
-        Some some = buildSomeValue( module );
-        Some some2 = buildSomeValue( module );
+        Some some = buildSomeValue( valueBuilderFactory );
+        Some some2 = buildSomeValue( valueBuilderFactory );
         assertThat( "Values equal",
                     some,
                     equalTo( some2 ) );
@@ -199,8 +199,8 @@ public class ValueEqualityTest
     @Test
     public void givenValuesOfTheSameTypeWithDifferentStateWhenTestingValueEqualityExpectNotEquals()
     {
-        Some some = buildSomeValue( module );
-        Some some2 = buildSomeValueWithDifferentState( module );
+        Some some = buildSomeValue( valueBuilderFactory );
+        Some some2 = buildSomeValueWithDifferentState( valueBuilderFactory );
         assertThat( "Values not equals",
                     some,
                     not( equalTo( some2 ) ) );
@@ -212,8 +212,8 @@ public class ValueEqualityTest
     @Test
     public void givenValuesOfDifferentTypesAndSameStateWhenTestingValueEqualityExpectNotEquals()
     {
-        Some some = buildSomeValue( module );
-        Some anotherSome = buildAnotherSomeValue( module );
+        Some some = buildSomeValue( valueBuilderFactory );
+        Some anotherSome = buildAnotherSomeValue( valueBuilderFactory );
 
         assertThat( "Values not equal",
                     some,
@@ -226,8 +226,8 @@ public class ValueEqualityTest
     @Test
     public void givenValuesOfDifferentTypesAndDifferentStateWhenTestingValueEqualityExpectNotEquals()
     {
-        Some some = buildSomeValue( module );
-        Some anotherSome = buildAnotherSomeValueWithDifferentState( module );
+        Some some = buildSomeValue( valueBuilderFactory );
+        Some anotherSome = buildAnotherSomeValueWithDifferentState( valueBuilderFactory );
         assertThat( "Values not equal",
                     some,
                     not( equalTo( anotherSome ) ) );

http://git-wip-us.apache.org/repos/asf/zest-java/blob/dedb068e/core/runtime/src/test/java/org/apache/zest/runtime/value/ValueInjectionDeserializationTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/zest/runtime/value/ValueInjectionDeserializationTest.java b/core/runtime/src/test/java/org/apache/zest/runtime/value/ValueInjectionDeserializationTest.java
index ceb8c7a..a562cd2 100644
--- a/core/runtime/src/test/java/org/apache/zest/runtime/value/ValueInjectionDeserializationTest.java
+++ b/core/runtime/src/test/java/org/apache/zest/runtime/value/ValueInjectionDeserializationTest.java
@@ -56,7 +56,7 @@ public class ValueInjectionDeserializationTest
         UnitOfWork uow = null;
         try
         {
-            ValueBuilder<Some> builder = module.newValueBuilder( Some.class );
+            ValueBuilder<Some> builder = valueBuilderFactory.newValueBuilder( Some.class );
             builder.prototype().data().set( "Niclas" );
             Some value = builder.newInstance();
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/dedb068e/core/runtime/src/test/java/org/apache/zest/runtime/value/ValueSerializationRegressionTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/zest/runtime/value/ValueSerializationRegressionTest.java b/core/runtime/src/test/java/org/apache/zest/runtime/value/ValueSerializationRegressionTest.java
index c62423b..13a3e14 100644
--- a/core/runtime/src/test/java/org/apache/zest/runtime/value/ValueSerializationRegressionTest.java
+++ b/core/runtime/src/test/java/org/apache/zest/runtime/value/ValueSerializationRegressionTest.java
@@ -52,7 +52,7 @@ public class ValueSerializationRegressionTest extends AbstractZestTest
     public void givenNewValueWhenConvertingToEntityExpectNewEntityInStore()
         throws UnitOfWorkCompletionException
     {
-        ValueBuilder<DualFaced> builder = module.newValueBuilder( DualFaced.class );
+        ValueBuilder<DualFaced> builder = valueBuilderFactory.newValueBuilder( DualFaced.class );
         builder.prototype().identity().set( "1234" );
         builder.prototype().name().set( "Hedhman" );
         DualFaced value = builder.newInstance();

http://git-wip-us.apache.org/repos/asf/zest-java/blob/dedb068e/core/runtime/src/test/java/org/apache/zest/runtime/value/ValueWithAssociationTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/zest/runtime/value/ValueWithAssociationTest.java b/core/runtime/src/test/java/org/apache/zest/runtime/value/ValueWithAssociationTest.java
index c16af32..c2eba27 100644
--- a/core/runtime/src/test/java/org/apache/zest/runtime/value/ValueWithAssociationTest.java
+++ b/core/runtime/src/test/java/org/apache/zest/runtime/value/ValueWithAssociationTest.java
@@ -113,7 +113,7 @@ public class ValueWithAssociationTest extends AbstractZestTest
     public void givenNewValueWhenConvertingToEntityExpectNewEntityInStore()
         throws UnitOfWorkCompletionException
     {
-        ValueBuilder<DualFaced> builder = module.newValueBuilder( DualFaced.class );
+        ValueBuilder<DualFaced> builder = valueBuilderFactory.newValueBuilder( DualFaced.class );
         builder.prototype().identity().set( "1234" );
         builder.prototype().name().set( "Hedhman" );
         DualFaced value = builder.newInstance();
@@ -156,12 +156,12 @@ public class ValueWithAssociationTest extends AbstractZestTest
             identity2 = faced.identity().get();
             uow.complete();
         }
-        ValueBuilder<SimpleName> vb1 = module.newValueBuilder( SimpleName.class );
+        ValueBuilder<SimpleName> vb1 = valueBuilderFactory.newValueBuilder( SimpleName.class );
         vb1.prototype().identity().set( identity1 );
         vb1.prototype().name().set( "Paul" );
         SimpleName simpleValue = vb1.newInstance();
 
-        ValueBuilder<DualFaced> vb2 = module.newValueBuilder( DualFaced.class );
+        ValueBuilder<DualFaced> vb2 = valueBuilderFactory.newValueBuilder( DualFaced.class );
         vb2.prototype().identity().set( identity2 );
         vb2.prototype().name().set( "Merlin" );
         vb2.prototype().simple().set( simpleValue );

http://git-wip-us.apache.org/repos/asf/zest-java/blob/dedb068e/core/runtime/src/test/java/org/apache/zest/spi/service/importer/InstanceImporterTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/zest/spi/service/importer/InstanceImporterTest.java b/core/runtime/src/test/java/org/apache/zest/spi/service/importer/InstanceImporterTest.java
index f8dd02c..045e89e 100644
--- a/core/runtime/src/test/java/org/apache/zest/spi/service/importer/InstanceImporterTest.java
+++ b/core/runtime/src/test/java/org/apache/zest/spi/service/importer/InstanceImporterTest.java
@@ -46,7 +46,7 @@ public class InstanceImporterTest
     @Test
     public void givenSingletonServiceObjectWhenServicesAreInjectedThenSingletonIsFound()
     {
-        module.injectTo( this );
+        module.instance().injectTo( this );
 
         assertThat( "service is injected properly", service.helloWorld(), equalTo( "Hello World" ) );
     }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/dedb068e/core/runtime/src/test/java/org/apache/zest/spi/service/importer/NewObjectImporterTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/zest/spi/service/importer/NewObjectImporterTest.java b/core/runtime/src/test/java/org/apache/zest/spi/service/importer/NewObjectImporterTest.java
index e382ba2..007ef61 100644
--- a/core/runtime/src/test/java/org/apache/zest/spi/service/importer/NewObjectImporterTest.java
+++ b/core/runtime/src/test/java/org/apache/zest/spi/service/importer/NewObjectImporterTest.java
@@ -45,8 +45,6 @@ public class NewObjectImporterTest
     @Test
     public void testImportServiceFromService()
     {
-        module.injectTo( this );
-
         Assert.assertThat( service.helloWorld(), CoreMatchers.equalTo( "Hello World" ) );
     }
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/dedb068e/core/runtime/src/test/java/org/apache/zest/spi/service/importer/ServiceInstanceImporterTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/zest/spi/service/importer/ServiceInstanceImporterTest.java b/core/runtime/src/test/java/org/apache/zest/spi/service/importer/ServiceInstanceImporterTest.java
index fb3afc9..49a1b3e 100644
--- a/core/runtime/src/test/java/org/apache/zest/spi/service/importer/ServiceInstanceImporterTest.java
+++ b/core/runtime/src/test/java/org/apache/zest/spi/service/importer/ServiceInstanceImporterTest.java
@@ -52,8 +52,6 @@ public class ServiceInstanceImporterTest
     @Test
     public void testImportServiceFromService()
     {
-        module.injectTo( this );
-
         Assert.assertThat( service.helloWorld(), CoreMatchers.equalTo( "Hello World" ) );
     }
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/dedb068e/core/runtime/src/test/java/org/apache/zest/test/composite/CleanStackTraceTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/zest/test/composite/CleanStackTraceTest.java b/core/runtime/src/test/java/org/apache/zest/test/composite/CleanStackTraceTest.java
index da247ff..3fc6339 100644
--- a/core/runtime/src/test/java/org/apache/zest/test/composite/CleanStackTraceTest.java
+++ b/core/runtime/src/test/java/org/apache/zest/test/composite/CleanStackTraceTest.java
@@ -67,7 +67,7 @@ public class CleanStackTraceTest
         {
             return;
         }
-        TestComposite composite = module.newTransient( TestComposite.class );
+        TestComposite composite = transientBuilderFactory.newTransient( TestComposite.class );
         try
         {
             composite.doStuff();

http://git-wip-us.apache.org/repos/asf/zest-java/blob/dedb068e/core/spi/src/main/java/org/apache/zest/spi/entitystore/ConcurrentModificationCheckConcern.java
----------------------------------------------------------------------
diff --git a/core/spi/src/main/java/org/apache/zest/spi/entitystore/ConcurrentModificationCheckConcern.java b/core/spi/src/main/java/org/apache/zest/spi/entitystore/ConcurrentModificationCheckConcern.java
index 9e85c83..09ffd58 100755
--- a/core/spi/src/main/java/org/apache/zest/spi/entitystore/ConcurrentModificationCheckConcern.java
+++ b/core/spi/src/main/java/org/apache/zest/spi/entitystore/ConcurrentModificationCheckConcern.java
@@ -22,9 +22,9 @@ import org.apache.zest.api.entity.EntityDescriptor;
 import org.apache.zest.api.entity.EntityReference;
 import org.apache.zest.api.injection.scope.Structure;
 import org.apache.zest.api.injection.scope.This;
+import org.apache.zest.api.structure.ModuleDescriptor;
 import org.apache.zest.api.usecase.Usecase;
 import org.apache.zest.spi.entity.EntityState;
-import org.apache.zest.spi.module.ModuleSpi;
 
 /**
  * Concern that helps EntityStores do concurrent modification checks.
@@ -47,9 +47,9 @@ public abstract class ConcurrentModificationCheckConcern
     private ZestAPI api;
 
     @Override
-    public EntityStoreUnitOfWork newUnitOfWork( Usecase usecase, long currentTime )
+    public EntityStoreUnitOfWork newUnitOfWork( ModuleDescriptor module, Usecase usecase, long currentTime )
     {
-        final EntityStoreUnitOfWork uow = next.newUnitOfWork( usecase, currentTime );
+        final EntityStoreUnitOfWork uow = next.newUnitOfWork( module, usecase, currentTime );
         return new ConcurrentCheckingEntityStoreUnitOfWork( uow, api.dereference( versions ), currentTime );
     }
 
@@ -163,9 +163,15 @@ public abstract class ConcurrentModificationCheckConcern
             return uow.usecase();
         }
 
+        @Override
+        public ModuleDescriptor module()
+        {
+            return uow.module();
+        }
+
         @SuppressWarnings( "DuplicateThrows" )
         @Override
-        public EntityState entityStateOf( ModuleSpi module, EntityReference anIdentity )
+        public EntityState entityStateOf( ModuleDescriptor module, EntityReference anIdentity )
             throws EntityStoreException, EntityNotFoundException
         {
             lock.readLock().lock();

http://git-wip-us.apache.org/repos/asf/zest-java/blob/dedb068e/core/spi/src/main/java/org/apache/zest/spi/entitystore/DefaultEntityStoreUnitOfWork.java
----------------------------------------------------------------------
diff --git a/core/spi/src/main/java/org/apache/zest/spi/entitystore/DefaultEntityStoreUnitOfWork.java b/core/spi/src/main/java/org/apache/zest/spi/entitystore/DefaultEntityStoreUnitOfWork.java
index f6e48f1..7e1c332 100755
--- a/core/spi/src/main/java/org/apache/zest/spi/entitystore/DefaultEntityStoreUnitOfWork.java
+++ b/core/spi/src/main/java/org/apache/zest/spi/entitystore/DefaultEntityStoreUnitOfWork.java
@@ -17,9 +17,9 @@ package org.apache.zest.spi.entitystore;
 import java.util.HashMap;
 import org.apache.zest.api.entity.EntityDescriptor;
 import org.apache.zest.api.entity.EntityReference;
+import org.apache.zest.api.structure.ModuleDescriptor;
 import org.apache.zest.api.usecase.Usecase;
 import org.apache.zest.spi.entity.EntityState;
-import org.apache.zest.spi.module.ModuleSpi;
 
 /**
  * Default EntityStore UnitOfWork.
@@ -27,18 +27,21 @@ import org.apache.zest.spi.module.ModuleSpi;
 public final class DefaultEntityStoreUnitOfWork
     implements EntityStoreUnitOfWork
 {
+    private final ModuleDescriptor module;
     private EntityStoreSPI entityStoreSPI;
     private String identity;
     private HashMap<EntityReference, EntityState> states = new HashMap<>();
     private Usecase usecase;
     private long currentTime;
 
-    public DefaultEntityStoreUnitOfWork( EntityStoreSPI entityStoreSPI,
+    public DefaultEntityStoreUnitOfWork( ModuleDescriptor module,
+                                         EntityStoreSPI entityStoreSPI,
                                          String identity,
                                          Usecase usecase,
                                          long currentTime
     )
     {
+        this.module = module;
         this.entityStoreSPI = entityStoreSPI;
         this.identity = identity;
         this.usecase = usecase;
@@ -62,7 +65,12 @@ public final class DefaultEntityStoreUnitOfWork
         return usecase;
     }
 
-    // EntityStore
+    @Override
+    public ModuleDescriptor module()
+    {
+        return module;
+    }
+// EntityStore
 
     @Override
     public EntityState newEntityState( EntityReference anIdentity, EntityDescriptor descriptor )
@@ -79,7 +87,7 @@ public final class DefaultEntityStoreUnitOfWork
     }
 
     @Override
-    public EntityState entityStateOf( ModuleSpi module, EntityReference anIdentity )
+    public EntityState entityStateOf( ModuleDescriptor module, EntityReference anIdentity )
         throws EntityNotFoundException
     {
         EntityState entityState = states.get( anIdentity );

http://git-wip-us.apache.org/repos/asf/zest-java/blob/dedb068e/core/spi/src/main/java/org/apache/zest/spi/entitystore/EntityStateVersions.java
----------------------------------------------------------------------
diff --git a/core/spi/src/main/java/org/apache/zest/spi/entitystore/EntityStateVersions.java b/core/spi/src/main/java/org/apache/zest/spi/entitystore/EntityStateVersions.java
index 57a7119..be57097 100755
--- a/core/spi/src/main/java/org/apache/zest/spi/entitystore/EntityStateVersions.java
+++ b/core/spi/src/main/java/org/apache/zest/spi/entitystore/EntityStateVersions.java
@@ -21,9 +21,11 @@ import java.util.WeakHashMap;
 import org.apache.zest.api.entity.EntityReference;
 import org.apache.zest.api.injection.scope.This;
 import org.apache.zest.api.mixin.Mixins;
+import org.apache.zest.api.structure.ModuleDescriptor;
 import org.apache.zest.api.usecase.Usecase;
 import org.apache.zest.spi.entity.EntityState;
 import org.apache.zest.spi.entity.EntityStatus;
+import org.apache.zest.spi.module.ModuleSpi;
 
 /**
  * Entity versions state.
@@ -81,7 +83,7 @@ public interface EntityStateVersions
                 String storeVersion = versions.get( entityState.identity() );
                 if( storeVersion == null )
                 {
-                    EntityStoreUnitOfWork unitOfWork = store.newUnitOfWork( Usecase.DEFAULT, currentTime );
+                    EntityStoreUnitOfWork unitOfWork = store.newUnitOfWork( entityState.entityDescriptor().module(), Usecase.DEFAULT, currentTime );
                     storeVersion = unitOfWork.versionOf( entityState.identity() );
                     unitOfWork.discard();
                 }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/dedb068e/core/spi/src/main/java/org/apache/zest/spi/entitystore/EntityStore.java
----------------------------------------------------------------------
diff --git a/core/spi/src/main/java/org/apache/zest/spi/entitystore/EntityStore.java b/core/spi/src/main/java/org/apache/zest/spi/entitystore/EntityStore.java
index 0a3d3e3..d172815 100755
--- a/core/spi/src/main/java/org/apache/zest/spi/entitystore/EntityStore.java
+++ b/core/spi/src/main/java/org/apache/zest/spi/entitystore/EntityStore.java
@@ -16,17 +16,17 @@
  */
 package org.apache.zest.spi.entitystore;
 
+import org.apache.zest.api.structure.ModuleDescriptor;
 import org.apache.zest.api.usecase.Usecase;
 import org.apache.zest.io.Input;
 import org.apache.zest.spi.entity.EntityState;
-import org.apache.zest.spi.module.ModuleSpi;
 
 /**
  * Interface that must be implemented by store for persistent state of EntityComposites.
  */
 public interface EntityStore
 {
-    EntityStoreUnitOfWork newUnitOfWork( Usecase usecase, long currentTime );
+    EntityStoreUnitOfWork newUnitOfWork( ModuleDescriptor module, Usecase usecase, long currentTime );
 
-    Input<EntityState, EntityStoreException> entityStates( ModuleSpi module );
+    Input<EntityState, EntityStoreException> entityStates( ModuleDescriptor module );
 }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/dedb068e/core/spi/src/main/java/org/apache/zest/spi/entitystore/EntityStoreSPI.java
----------------------------------------------------------------------
diff --git a/core/spi/src/main/java/org/apache/zest/spi/entitystore/EntityStoreSPI.java b/core/spi/src/main/java/org/apache/zest/spi/entitystore/EntityStoreSPI.java
index fc125a7..6fccb64 100755
--- a/core/spi/src/main/java/org/apache/zest/spi/entitystore/EntityStoreSPI.java
+++ b/core/spi/src/main/java/org/apache/zest/spi/entitystore/EntityStoreSPI.java
@@ -16,8 +16,8 @@ package org.apache.zest.spi.entitystore;
 
 import org.apache.zest.api.entity.EntityDescriptor;
 import org.apache.zest.api.entity.EntityReference;
+import org.apache.zest.api.structure.ModuleDescriptor;
 import org.apache.zest.spi.entity.EntityState;
-import org.apache.zest.spi.module.ModuleSpi;
 
 /**
  * EntityStore SPI.
@@ -28,10 +28,9 @@ public interface EntityStoreSPI
                                 EntityReference identity, EntityDescriptor entityDescriptor
     );
 
-    EntityState entityStateOf( EntityStoreUnitOfWork unitOfWork, ModuleSpi module, EntityReference identity );
+    EntityState entityStateOf( EntityStoreUnitOfWork unitOfWork, ModuleDescriptor module, EntityReference identity );
 
     String versionOf( EntityStoreUnitOfWork unitOfWork, EntityReference identity );
 
-    StateCommitter applyChanges( EntityStoreUnitOfWork unitOfWork, Iterable<EntityState> state
-    );
+    StateCommitter applyChanges( EntityStoreUnitOfWork unitOfWork, Iterable<EntityState> state );
 }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/dedb068e/core/spi/src/main/java/org/apache/zest/spi/entitystore/EntityStoreUnitOfWork.java
----------------------------------------------------------------------
diff --git a/core/spi/src/main/java/org/apache/zest/spi/entitystore/EntityStoreUnitOfWork.java b/core/spi/src/main/java/org/apache/zest/spi/entitystore/EntityStoreUnitOfWork.java
index e5d569c..b35854e 100755
--- a/core/spi/src/main/java/org/apache/zest/spi/entitystore/EntityStoreUnitOfWork.java
+++ b/core/spi/src/main/java/org/apache/zest/spi/entitystore/EntityStoreUnitOfWork.java
@@ -16,9 +16,9 @@ package org.apache.zest.spi.entitystore;
 
 import org.apache.zest.api.entity.EntityDescriptor;
 import org.apache.zest.api.entity.EntityReference;
+import org.apache.zest.api.structure.ModuleDescriptor;
 import org.apache.zest.api.usecase.Usecase;
 import org.apache.zest.spi.entity.EntityState;
-import org.apache.zest.spi.module.ModuleSpi;
 
 /**
  * EntityStore UnitOfWork.
@@ -49,6 +49,8 @@ public interface EntityStoreUnitOfWork
      * Get the EntityState for a given identity. Throws {@link EntityNotFoundException}
      * if the entity with given {@code anIdentity} is not found.
      *
+     *
+     * @param module
      * @param anIdentity The entity identity. This argument must not be {@code null}.
      *
      * @return Entity state given the composite descriptor and identity.
@@ -56,7 +58,7 @@ public interface EntityStoreUnitOfWork
      * @throws EntityStoreException    thrown if retrieval failed.
      * @throws EntityNotFoundException if requested entity does not exist
      */
-    EntityState entityStateOf( ModuleSpi module, EntityReference anIdentity )
+    EntityState entityStateOf( ModuleDescriptor module, EntityReference anIdentity )
         throws EntityStoreException, EntityNotFoundException;
 
     String versionOf( EntityReference anIdentity ) throws EntityStoreException;
@@ -67,4 +69,6 @@ public interface EntityStoreUnitOfWork
     void discard();
 
     Usecase usecase();
+
+    ModuleDescriptor module();
 }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/dedb068e/core/spi/src/main/java/org/apache/zest/spi/entitystore/helpers/JSONEntityState.java
----------------------------------------------------------------------
diff --git a/core/spi/src/main/java/org/apache/zest/spi/entitystore/helpers/JSONEntityState.java b/core/spi/src/main/java/org/apache/zest/spi/entitystore/helpers/JSONEntityState.java
index 1b2a1df..09ce715 100644
--- a/core/spi/src/main/java/org/apache/zest/spi/entitystore/helpers/JSONEntityState.java
+++ b/core/spi/src/main/java/org/apache/zest/spi/entitystore/helpers/JSONEntityState.java
@@ -19,13 +19,11 @@
  */
 package org.apache.zest.spi.entitystore.helpers;
 
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
 import org.apache.zest.api.common.QualifiedName;
 import org.apache.zest.api.entity.EntityDescriptor;
 import org.apache.zest.api.entity.EntityReference;
 import org.apache.zest.api.property.PropertyDescriptor;
+import org.apache.zest.api.structure.ModuleDescriptor;
 import org.apache.zest.api.type.ValueType;
 import org.apache.zest.api.value.ValueSerialization;
 import org.apache.zest.api.value.ValueSerializationException;
@@ -34,6 +32,9 @@ import org.apache.zest.spi.entity.EntityStatus;
 import org.apache.zest.spi.entity.ManyAssociationState;
 import org.apache.zest.spi.entity.NamedAssociationState;
 import org.apache.zest.spi.entitystore.EntityStoreException;
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
 
 /**
  * Standard JSON implementation of EntityState.
@@ -51,6 +52,7 @@ public final class JSONEntityState
             JSONKeys.MODIFIED
         };
 
+    private final ModuleDescriptor module;
     private final ValueSerialization valueSerialization;
     private final String version;
     private final EntityReference identity;
@@ -60,23 +62,8 @@ public final class JSONEntityState
     private long lastModified;
     private JSONObject state;
 
-    /* package */ JSONEntityState( long time,
+    /* package */ JSONEntityState( ModuleDescriptor module,
                                    ValueSerialization valueSerialization,
-                                   EntityReference identity,
-                                   EntityDescriptor entityDescriptor,
-                                   JSONObject initialState
-    )
-    {
-        this( valueSerialization,
-              "",
-              time,
-              identity,
-              EntityStatus.NEW,
-              entityDescriptor,
-              initialState );
-    }
-
-    /* package */ JSONEntityState( ValueSerialization valueSerialization,
                                    String version,
                                    long lastModified,
                                    EntityReference identity,
@@ -85,6 +72,7 @@ public final class JSONEntityState
                                    JSONObject state
     )
     {
+        this.module = module;
         this.valueSerialization = valueSerialization;
         this.version = version;
         this.lastModified = lastModified;
@@ -130,7 +118,7 @@ public final class JSONEntityState
                 {
                     return null;
                 }
-                return valueSerialization.deserialize( descriptor.valueType(), json.toString() );
+                return valueSerialization.deserialize( module, descriptor.valueType(), json.toString() );
             }
         }
         catch( ValueSerializationException | JSONException e )

http://git-wip-us.apache.org/repos/asf/zest-java/blob/dedb068e/core/spi/src/main/java/org/apache/zest/spi/entitystore/helpers/JSONMapEntityStoreMixin.java
----------------------------------------------------------------------
diff --git a/core/spi/src/main/java/org/apache/zest/spi/entitystore/helpers/JSONMapEntityStoreMixin.java b/core/spi/src/main/java/org/apache/zest/spi/entitystore/helpers/JSONMapEntityStoreMixin.java
index 8dedcfd..a963118 100755
--- a/core/spi/src/main/java/org/apache/zest/spi/entitystore/helpers/JSONMapEntityStoreMixin.java
+++ b/core/spi/src/main/java/org/apache/zest/spi/entitystore/helpers/JSONMapEntityStoreMixin.java
@@ -39,6 +39,7 @@ import org.apache.zest.api.injection.scope.Uses;
 import org.apache.zest.api.service.ServiceDescriptor;
 import org.apache.zest.api.service.qualifier.Tagged;
 import org.apache.zest.api.structure.Application;
+import org.apache.zest.api.structure.ModuleDescriptor;
 import org.apache.zest.api.unitofwork.EntityTypeNotFoundException;
 import org.apache.zest.api.usecase.Usecase;
 import org.apache.zest.api.value.ValueSerialization;
@@ -58,8 +59,6 @@ import org.apache.zest.spi.entitystore.EntityStoreException;
 import org.apache.zest.spi.entitystore.EntityStoreSPI;
 import org.apache.zest.spi.entitystore.EntityStoreUnitOfWork;
 import org.apache.zest.spi.entitystore.StateCommitter;
-import org.apache.zest.spi.structure.ModelModule;
-import org.apache.zest.spi.module.ModuleSpi;
 import org.json.JSONException;
 import org.json.JSONObject;
 import org.json.JSONTokener;
@@ -139,9 +138,9 @@ public class JSONMapEntityStoreMixin
     // EntityStore
 
     @Override
-    public EntityStoreUnitOfWork newUnitOfWork( Usecase usecaseMetaInfo, long currentTime )
+    public EntityStoreUnitOfWork newUnitOfWork( ModuleDescriptor module, Usecase usecaseMetaInfo, long currentTime )
     {
-        return new DefaultEntityStoreUnitOfWork( entityStoreSpi, newUnitOfWorkId(), usecaseMetaInfo, currentTime );
+        return new DefaultEntityStoreUnitOfWork( module, entityStoreSpi, newUnitOfWorkId(), usecaseMetaInfo, currentTime );
     }
 
     // EntityStoreSPI
@@ -164,8 +163,14 @@ public class JSONMapEntityStoreMixin
             state.put( JSONKeys.ASSOCIATIONS, new JSONObject() );
             state.put( JSONKeys.MANY_ASSOCIATIONS, new JSONObject() );
             state.put( JSONKeys.NAMED_ASSOCIATIONS, new JSONObject() );
-            return new JSONEntityState( unitOfWork.currentTime(), valueSerialization,
-                                        identity, entityDescriptor, state );
+            return new JSONEntityState( entityDescriptor.module(),
+                                        valueSerialization,
+                                        "",
+                                        unitOfWork.currentTime(),
+                                        identity,
+                                        EntityStatus.NEW,
+                                        entityDescriptor,
+                                        state );
         }
         catch( JSONException e )
         {
@@ -175,7 +180,7 @@ public class JSONMapEntityStoreMixin
 
     @Override
     public synchronized EntityState entityStateOf( EntityStoreUnitOfWork unitOfWork,
-                                                   ModuleSpi module,
+                                                   ModuleDescriptor module,
                                                    EntityReference identity
     )
     {
@@ -196,7 +201,7 @@ public class JSONMapEntityStoreMixin
 
     @Override
     public synchronized String versionOf( EntityStoreUnitOfWork unitOfWork,
-                                                   EntityReference identity
+                                          EntityReference identity
     )
     {
         CacheState cacheState = cache.get( identity.identity() );
@@ -298,7 +303,7 @@ public class JSONMapEntityStoreMixin
     }
 
     @Override
-    public Input<EntityState, EntityStoreException> entityStates( final ModuleSpi module )
+    public Input<EntityState, EntityStoreException> entityStates( final ModuleDescriptor module )
     {
         return new Input<EntityState, EntityStoreException>()
         {
@@ -417,7 +422,7 @@ public class JSONMapEntityStoreMixin
         }
     }
 
-    protected JSONEntityState readEntityState( ModuleSpi module, Reader entityState )
+    protected JSONEntityState readEntityState( ModuleDescriptor module, Reader entityState )
         throws EntityStoreException
     {
         try
@@ -457,14 +462,11 @@ public class JSONMapEntityStoreMixin
             EntityDescriptor entityDescriptor = module.entityDescriptor( type );
             if( entityDescriptor == null )
             {
-                throw new EntityTypeNotFoundException( type,
-                                                       module.name(),
-                                                       module.findVisibleEntityTypes()
-                                                           .map( ModelModule.toStringFunction )
-                );
+                throw EntityTypeNotFoundException.create( type, module );
             }
 
-            return new JSONEntityState( valueSerialization,
+            return new JSONEntityState( module,
+                                        valueSerialization,
                                         version,
                                         modified,
                                         EntityReference.parseEntityReference( identity ),
@@ -493,7 +495,7 @@ public class JSONMapEntityStoreMixin
         }
     }
 
-    private EntityState fetchCachedState( EntityReference identity, ModuleSpi module, long currentTime )
+    private EntityState fetchCachedState( EntityReference identity, ModuleDescriptor module, long currentTime )
     {
         CacheState cacheState = cache.get( identity.identity() );
         if( cacheState != null )
@@ -503,7 +505,7 @@ public class JSONMapEntityStoreMixin
             {
                 String type = data.getString( JSONKeys.TYPE );
                 EntityDescriptor entityDescriptor = module.entityDescriptor( type );
-                return new JSONEntityState( valueSerialization, data.getString( JSONKeys.VERSION ), data.getLong( JSONKeys.MODIFIED ), identity, EntityStatus.LOADED, entityDescriptor, data );
+                return new JSONEntityState( module, valueSerialization, data.getString( JSONKeys.VERSION ), data.getLong( JSONKeys.MODIFIED ), identity, EntityStatus.LOADED, entityDescriptor, data );
             }
             catch( JSONException e )
             {

http://git-wip-us.apache.org/repos/asf/zest-java/blob/dedb068e/core/spi/src/main/java/org/apache/zest/spi/entitystore/helpers/MapEntityStoreMixin.java
----------------------------------------------------------------------
diff --git a/core/spi/src/main/java/org/apache/zest/spi/entitystore/helpers/MapEntityStoreMixin.java b/core/spi/src/main/java/org/apache/zest/spi/entitystore/helpers/MapEntityStoreMixin.java
index d553437..55830d8 100755
--- a/core/spi/src/main/java/org/apache/zest/spi/entitystore/helpers/MapEntityStoreMixin.java
+++ b/core/spi/src/main/java/org/apache/zest/spi/entitystore/helpers/MapEntityStoreMixin.java
@@ -37,6 +37,7 @@ import org.apache.zest.api.injection.scope.Structure;
 import org.apache.zest.api.injection.scope.This;
 import org.apache.zest.api.service.qualifier.Tagged;
 import org.apache.zest.api.structure.Application;
+import org.apache.zest.api.structure.ModuleDescriptor;
 import org.apache.zest.api.type.ValueType;
 import org.apache.zest.api.unitofwork.EntityTypeNotFoundException;
 import org.apache.zest.api.usecase.Usecase;
@@ -55,8 +56,6 @@ import org.apache.zest.spi.entitystore.EntityStoreException;
 import org.apache.zest.spi.entitystore.EntityStoreSPI;
 import org.apache.zest.spi.entitystore.EntityStoreUnitOfWork;
 import org.apache.zest.spi.entitystore.StateCommitter;
-import org.apache.zest.spi.structure.ModelModule;
-import org.apache.zest.spi.module.ModuleSpi;
 import org.json.JSONArray;
 import org.json.JSONException;
 import org.json.JSONObject;
@@ -109,9 +108,9 @@ public class MapEntityStoreMixin
 
     // EntityStore
     @Override
-    public EntityStoreUnitOfWork newUnitOfWork( Usecase usecaseMetaInfo, long currentTime )
+    public EntityStoreUnitOfWork newUnitOfWork( ModuleDescriptor module, Usecase usecaseMetaInfo, long currentTime )
     {
-        return new DefaultEntityStoreUnitOfWork( entityStoreSpi, newUnitOfWorkId(), usecaseMetaInfo, currentTime );
+        return new DefaultEntityStoreUnitOfWork( module, entityStoreSpi, newUnitOfWorkId(), usecaseMetaInfo, currentTime );
     }
 
     // EntityStoreSPI
@@ -126,7 +125,7 @@ public class MapEntityStoreMixin
 
     @Override
     public synchronized EntityState entityStateOf( EntityStoreUnitOfWork unitofwork,
-                                                   ModuleSpi module,
+                                                   ModuleDescriptor module,
                                                    EntityReference identity
     )
     {
@@ -136,7 +135,7 @@ public class MapEntityStoreMixin
 
     @Override
     public synchronized String versionOf( EntityStoreUnitOfWork unitofwork,
-                                                   EntityReference identity
+                                          EntityReference identity
     )
     {
         Reader in = mapEntityStore.get( identity );
@@ -202,7 +201,7 @@ public class MapEntityStoreMixin
     }
 
     @Override
-    public Input<EntityState, EntityStoreException> entityStates( final ModuleSpi module )
+    public Input<EntityState, EntityStoreException> entityStates( final ModuleDescriptor module )
     {
         return new Input<EntityState, EntityStoreException>()
         {
@@ -379,13 +378,13 @@ public class MapEntityStoreMixin
         }
     }
 
-    protected EntityState readEntityState( ModuleSpi module, Reader entityState )
+    protected EntityState readEntityState( ModuleDescriptor module, Reader entityState )
         throws EntityStoreException
     {
         try
         {
             JSONObject jsonObject = new JSONObject( new JSONTokener( entityState ) );
-            final EntityStatus[] status = {EntityStatus.LOADED};
+            final EntityStatus[] status = { EntityStatus.LOADED };
 
             String version = jsonObject.getString( JSONKeys.VERSION );
             long modified = jsonObject.getLong( JSONKeys.MODIFIED );
@@ -405,7 +404,7 @@ public class MapEntityStoreMixin
                     jsonObject.put( JSONKeys.APPLICATION_VERSION, application.version() );
                 }
                 // State changed
-                status[0] = EntityStatus.UPDATED;
+                status[ 0 ] = EntityStatus.UPDATED;
             }
 
             String type = jsonObject.getString( JSONKeys.TYPE );
@@ -413,11 +412,7 @@ public class MapEntityStoreMixin
             EntityDescriptor entityDescriptor = module.entityDescriptor( type );
             if( entityDescriptor == null )
             {
-                throw new EntityTypeNotFoundException( type,
-                                                       module.name(),
-                                                       module.findVisibleEntityTypes()
-                                                           .map( ModelModule.toStringFunction )
-                );
+                throw EntityTypeNotFoundException.create( type, module );
             }
 
             Map<QualifiedName, Object> properties = new HashMap<>();
@@ -433,7 +428,8 @@ public class MapEntityStoreMixin
                     }
                     else
                     {
-                        Object value = valueSerialization.deserialize( propertyDescriptor.valueType(), jsonValue.toString() );
+                        Object value = valueSerialization.deserialize( module, propertyDescriptor.valueType(), jsonValue
+                            .toString() );
                         properties.put( propertyDescriptor.qualifiedName(), value );
                     }
                 }
@@ -442,7 +438,7 @@ public class MapEntityStoreMixin
                     // Value not found, default it
                     Object initialValue = propertyDescriptor.initialValue( module );
                     properties.put( propertyDescriptor.qualifiedName(), initialValue );
-                    status[0] = EntityStatus.UPDATED;
+                    status[ 0 ] = EntityStatus.UPDATED;
                 }
             } );
 
@@ -461,7 +457,7 @@ public class MapEntityStoreMixin
                 {
                     // Association not found, default it to null
                     associations.put( associationType.qualifiedName(), null );
-                    status[0] = EntityStatus.UPDATED;
+                    status[ 0 ] = EntityStatus.UPDATED;
                 }
             } );
 
@@ -516,12 +512,12 @@ public class MapEntityStoreMixin
                     // NamedAssociation not found, default to empty one
                     namedAssociations.put( namedAssociationType.qualifiedName(), references );
                 }
-            }  );
+            } );
 
             return new DefaultEntityState( version,
                                            modified,
                                            EntityReference.parseEntityReference( identity ),
-                                           status[0],
+                                           status[ 0 ],
                                            entityDescriptor,
                                            properties,
                                            associations,

http://git-wip-us.apache.org/repos/asf/zest-java/blob/dedb068e/core/spi/src/main/java/org/apache/zest/spi/module/ModuleSpi.java
----------------------------------------------------------------------
diff --git a/core/spi/src/main/java/org/apache/zest/spi/module/ModuleSpi.java b/core/spi/src/main/java/org/apache/zest/spi/module/ModuleSpi.java
index cb5208c..9192478 100644
--- a/core/spi/src/main/java/org/apache/zest/spi/module/ModuleSpi.java
+++ b/core/spi/src/main/java/org/apache/zest/spi/module/ModuleSpi.java
@@ -16,14 +16,10 @@
 */
 package org.apache.zest.spi.module;
 
-import java.util.stream.Stream;
-import org.apache.zest.api.composite.ModelDescriptor;
 import org.apache.zest.api.entity.IdentityGenerator;
 import org.apache.zest.api.metrics.MetricsProvider;
-import org.apache.zest.api.service.ServiceReference;
-import org.apache.zest.spi.structure.TypeLookup;
-import org.apache.zest.spi.structure.ModelModule;
 import org.apache.zest.api.structure.Module;
+import org.apache.zest.api.structure.TypeLookup;
 import org.apache.zest.api.value.ValueSerialization;
 import org.apache.zest.spi.entitystore.EntityStore;
 
@@ -35,16 +31,6 @@ public interface ModuleSpi extends Module
 
     ValueSerialization valueSerialization();
 
-    Stream<ModelModule<? extends ModelDescriptor>> findVisibleEntityTypes();
-
-    Stream<ModelModule<? extends ModelDescriptor>> findVisibleValueTypes();
-
-    Stream<ModelModule<? extends ModelDescriptor>> findVisibleTransientTypes();
-
-    Stream<ModelModule<? extends ModelDescriptor>> findVisibleObjectTypes();
-
-    Stream<ServiceReference<?>> findVisibleServiceTypes();
-
     TypeLookup typeLookup();
 
     MetricsProvider metricsProvider();

http://git-wip-us.apache.org/repos/asf/zest-java/blob/dedb068e/core/spi/src/main/java/org/apache/zest/spi/structure/ModelModule.java
----------------------------------------------------------------------
diff --git a/core/spi/src/main/java/org/apache/zest/spi/structure/ModelModule.java b/core/spi/src/main/java/org/apache/zest/spi/structure/ModelModule.java
deleted file mode 100644
index 6b584ae..0000000
--- a/core/spi/src/main/java/org/apache/zest/spi/structure/ModelModule.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.zest.spi.structure;
-
-import java.util.function.Function;
-import org.apache.zest.api.composite.ModelDescriptor;
-import org.apache.zest.spi.module.ModuleSpi;
-
-/**
- * TODO
- */
-public class ModelModule<T extends ModelDescriptor>
-{
-
-    public static Function<ModelModule<?>, String> toStringFunction = item -> item.model()
-                                                                                  .types()
-                                                                                  .iterator()
-                                                                                  .next()
-                                                                                  .getName() + "[" + item.module()
-                                                                                  .name() + "]";
-
-    public static <T extends ModelDescriptor> Function<T, ModelModule<T>> modelModuleFunction( final ModuleSpi module )
-    {
-        return model1 -> new ModelModule<>( module, model1 );
-    }
-
-    public static Function<ModelModule<? extends ModelDescriptor>, ModelDescriptor> modelFunction()
-    {
-        return modelModule -> {
-            return modelModule.model();
-        };
-    }
-
-    private final ModuleSpi module;
-    private final T model;
-
-    public ModelModule( ModuleSpi module, T model )
-    {
-        this.module = module;
-        this.model = model;
-    }
-
-    public ModuleSpi module()
-    {
-        return module;
-    }
-
-    public T model()
-    {
-        return model;
-    }
-
-    @Override
-    public boolean equals( Object o )
-    {
-        if( this == o )
-        {
-            return true;
-        }
-        if( o == null || getClass() != o.getClass() )
-        {
-            return false;
-        }
-
-        ModelModule that = (ModelModule) o;
-
-        //noinspection SimplifiableIfStatement
-        if( model != null ? !model.equals( that.model ) : that.model != null )
-        {
-            return false;
-        }
-
-        return !( module != null ? !module.equals( that.module ) : that.module != null );
-    }
-
-    @Override
-    public int hashCode()
-    {
-        int result = module != null ? module.hashCode() : 0;
-        result = 31 * result + ( model != null ? model.hashCode() : 0 );
-        return result;
-    }
-
-    @Override
-    public String toString()
-    {
-        return module.name() + ":" + model;
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/dedb068e/core/spi/src/main/java/org/apache/zest/spi/structure/TypeLookup.java
----------------------------------------------------------------------
diff --git a/core/spi/src/main/java/org/apache/zest/spi/structure/TypeLookup.java b/core/spi/src/main/java/org/apache/zest/spi/structure/TypeLookup.java
deleted file mode 100644
index 94e0473..0000000
--- a/core/spi/src/main/java/org/apache/zest/spi/structure/TypeLookup.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.zest.spi.structure;
-
-import java.lang.reflect.Type;
-import java.util.List;
-import java.util.stream.Stream;
-import org.apache.zest.api.composite.TransientDescriptor;
-import org.apache.zest.api.entity.EntityDescriptor;
-import org.apache.zest.api.object.ObjectDescriptor;
-import org.apache.zest.api.service.ServiceReference;
-import org.apache.zest.api.value.ValueDescriptor;
-
-public interface TypeLookup
-{
-    /**
-     * Lookup first Entity Model matching the given Type.
-     *
-     * <p>First, if Entity Models exactly match the given type, the closest one (Visibility then Assembly order) is returned.
-     * Multiple <b>exact</b> matches with the same Visibility are <b>forbidden</b> and result in an AmbiguousTypeException.</p>
-     *
-     * <p>Second, if Entity Models match a type assignable to the given type, the closest one (Visibility then Assembly order) is returned.
-     * Multiple <b>assignable</b> matches with the same Visibility are <b>forbidden</b> and result in an AmbiguousTypeException.</p>
-     *
-     * <p>Type lookup is done lazily and cached.</p>
-     *
-     * <p><b>Should be used for creational use cases only.</b> For non-creational use cases see
-     * {@link #lookupEntityModels(Class)}.</p>
-     *
-     * @param type Looked up Type
-     *
-     * @return First matching Entity Model
-     */
-    ModelModule<EntityDescriptor> lookupEntityModel( Class type );
-
-    /**
-     * Lookup all Entity Models matching the given Type.
-     *
-     * <p>Returned Iterable contains, in order, Entity Models that: </p>
-     *
-     * <ul>
-     * <li>exactly match the given type, in Visibility then Assembly order ;</li>
-     * <li>match a type assignable to the given type, in Visibility then Assembly order.</li>
-     * </ul>
-     *
-     * <p>Multiple <b>exact</b> matches with the same Visibility are <b>forbidden</b> and result in an AmbiguousTypeException.</p>
-     * <p>Multiple <b>assignable</b> matches are <b>allowed</b> to enable polymorphic fetches and queries.</p>
-     *
-     * <p>Type lookup is done lazily and cached.</p>
-     *
-     * <p><b>Should be used for non-creational use cases only.</b> For creational use cases see
-     * {@link #lookupEntityModel(Class)}.</p>
-     *
-     * @param type Looked up Type
-     *
-     * @return All matching Entity Models
-     */
-    Iterable<ModelModule<EntityDescriptor>> lookupEntityModels( Class type );
-
-    /**
-     * Lookup first ServiceReference matching the given Type.
-     *
-     * <p>Type lookup is done lazily and cached.</p>
-     *
-     * <p>See {@link #lookupServiceReferences(Type)}.</p>
-     *
-     * @param <T>         Service Type
-     * @param serviceType Looked up Type
-     *
-     * @return First matching ServiceReference
-     */
-    <T> ServiceReference<T> lookupServiceReference( Type serviceType );
-
-    /**
-     * Lookup all ServiceReferences matching the given Type.
-     *
-     * <p>Returned Iterable contains, in order, ServiceReferences that: </p>
-     *
-     * <ul>
-     * <li>exactly match the given type, in Visibility then Assembly order ;</li>
-     * <li>match a type assignable to the given type, in Visibility then Assembly order.</li>
-     * </ul>
-     *
-     * <p>Multiple <b>exact</b> matches with the same Visibility are <b>allowed</b> to enable polymorphic lookup/injection.</p>
-     * <p>Multiple <b>assignable</b> matches with the same Visibility are <b>allowed</b> for the very same reason.</p>
-     *
-     * <p>Type lookup is done lazily and cached.</p>
-     *
-     * @param <T>  Service Type
-     * @param type Looked up Type
-     *
-     * @return All matching ServiceReferences
-     */
-    <T> List<ServiceReference<T>> lookupServiceReferences( Type type );
-
-    Stream<Class<?>> allVisibleObjects();
-
-    Stream<ModelModule<ObjectDescriptor>> allObjects();
-
-    Stream<ModelModule<TransientDescriptor>> allTransients();
-
-    Stream<ModelModule<ValueDescriptor>> allValues();
-
-    Stream<ModelModule<EntityDescriptor>> allEntities();
-
-    Stream<ServiceReference<?>> allServices();
-}


Mime
View raw message