polygene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nic...@apache.org
Subject zest-java git commit: In the haste of renaming and unifying the type not found exception (so that one get a list of visible types), I incorrectly assumed that all ServiceDescriptors implements/extends from CompositeDescriptor. That is incorrect for Impor
Date Fri, 15 Apr 2016 08:35:19 GMT
Repository: zest-java
Updated Branches:
  refs/heads/develop b8ee1cf3e -> f21cc656a


In the haste of renaming and unifying the type not found exception (so that one get a list
of visible types), I incorrectly assumed that all ServiceDescriptors implements/extends from
CompositeDescriptor. That is incorrect for ImportedServices.


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

Branch: refs/heads/develop
Commit: f21cc656a72b6fb5fdca112b05133d7e63455a3d
Parents: b8ee1cf
Author: Niclas Hedhman <niclas@hedhman.org>
Authored: Fri Apr 15 16:34:54 2016 +0800
Committer: Niclas Hedhman <niclas@hedhman.org>
Committed: Fri Apr 15 16:34:54 2016 +0800

----------------------------------------------------------------------
 core/api/src/docs/objects.txt                          |  2 +-
 .../zest/api/service/NoSuchServiceException.java       | 13 +++++++++++--
 2 files changed, 12 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zest-java/blob/f21cc656/core/api/src/docs/objects.txt
----------------------------------------------------------------------
diff --git a/core/api/src/docs/objects.txt b/core/api/src/docs/objects.txt
index 8dbc654..680e33f 100644
--- a/core/api/src/docs/objects.txt
+++ b/core/api/src/docs/objects.txt
@@ -11,7 +11,7 @@
  * and limitations under the License.
 //////////////////////
 
-[[core-api-value,Object]]
+[[core-api-object,Objects]]
 = Objects =
 There are times when Apache Zest needs to interoperate with other systems, which
 does not have interfaces as their abstraction. Zest has a notion of

http://git-wip-us.apache.org/repos/asf/zest-java/blob/f21cc656/core/api/src/main/java/org/apache/zest/api/service/NoSuchServiceException.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/service/NoSuchServiceException.java
b/core/api/src/main/java/org/apache/zest/api/service/NoSuchServiceException.java
index cda13ed..a7a3df4 100644
--- a/core/api/src/main/java/org/apache/zest/api/service/NoSuchServiceException.java
+++ b/core/api/src/main/java/org/apache/zest/api/service/NoSuchServiceException.java
@@ -22,6 +22,7 @@ package org.apache.zest.api.service;
 
 import java.util.stream.Collectors;
 import org.apache.zest.api.composite.CompositeDescriptor;
+import org.apache.zest.api.composite.ModelDescriptor;
 import org.apache.zest.api.composite.NoSuchCompositeException;
 import org.apache.zest.api.structure.TypeLookup;
 
@@ -38,8 +39,16 @@ public class NoSuchServiceException extends NoSuchCompositeException
     private static String formatVisibleTypes( TypeLookup typeLookup )
     {
         return typeLookup.allServices()
-            .map( descriptor -> ( CompositeDescriptor) descriptor )
-            .map(descriptor -> descriptor.primaryType().getName())
+            .map( NoSuchServiceException::typeOf )
             .collect( Collectors.joining( "\n", "Visible service types are:\n", "" ) );
     }
+
+    private static String typeOf( ModelDescriptor descriptor )
+    {
+        if( descriptor instanceof CompositeDescriptor )
+        {
+            return ( (CompositeDescriptor) descriptor ).primaryType().getName();
+        }
+        return descriptor.types().map( Class::getName ).collect( Collectors.joining( ",",
"[", "]") );
+    }
 }


Mime
View raw message