polygene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nic...@apache.org
Subject [09/10] polygene-java git commit: SingletonAssembler gets lambda as constructor argument. @FunctionalInterface on LayerAssembler and ModuleAssembler.
Date Sun, 14 May 2017 04:08:14 GMT
SingletonAssembler gets lambda as constructor argument. @FunctionalInterface on LayerAssembler
and ModuleAssembler.

Signed-off-by: niclas <niclas@hedhman.org>


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

Branch: refs/heads/develop
Commit: 7956f2d6d9daf597364ba8dc070f98deb4fc43ef
Parents: 931c2ee
Author: niclas <niclas@hedhman.org>
Authored: Sat May 13 19:04:03 2017 +0800
Committer: niclas <niclas@hedhman.org>
Committed: Sun May 14 12:07:56 2017 +0800

----------------------------------------------------------------------
 .../polygene/bootstrap/SingletonAssembler.java  | 25 +++++++++++++++++---
 .../bootstrap/layered/LayerAssembler.java       |  1 +
 .../bootstrap/layered/ModuleAssembler.java      |  1 +
 3 files changed, 24 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/polygene-java/blob/7956f2d6/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/SingletonAssembler.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/SingletonAssembler.java
b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/SingletonAssembler.java
index 428d548..051c8d5 100644
--- a/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/SingletonAssembler.java
+++ b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/SingletonAssembler.java
@@ -20,6 +20,7 @@
 
 package org.apache.polygene.bootstrap;
 
+import java.util.function.Consumer;
 import org.apache.polygene.api.PolygeneAPI;
 import org.apache.polygene.api.activation.ActivationException;
 import org.apache.polygene.api.composite.TransientBuilderFactory;
@@ -38,12 +39,20 @@ import org.apache.polygene.api.value.ValueBuilderFactory;
  * an Application which can be accessed from {@link org.apache.polygene.bootstrap.SingletonAssembler#application()}.
  * You can also easily access any resources specific for the single Module, such as the TransientBuilderFactory.
  */
-public abstract class SingletonAssembler
+public class SingletonAssembler
     implements Assembler
 {
-    private Energy4Java polygene;
-    private Application applicationInstance;
+    private final Energy4Java polygene;
+    private final Application applicationInstance;
     private final Module moduleInstance;
+    private Consumer<ModuleAssembly> assemble;
+
+    public SingletonAssembler( Consumer<ModuleAssembly> assemble )
+        throws ActivationException
+    {
+        this();
+        this.assemble = assemble;
+    }
 
     /**
      * Creates a Polygene Runtime instance containing one Layer with one Module.
@@ -126,4 +135,14 @@ public abstract class SingletonAssembler
     {
         return moduleInstance.objectFactory();
     }
+
+    @Override
+    public void assemble( ModuleAssembly module )
+        throws AssemblyException
+    {
+        if( assemble != null )
+        {
+            assemble.accept( module );
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/7956f2d6/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/layered/LayerAssembler.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/layered/LayerAssembler.java
b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/layered/LayerAssembler.java
index 1d91d88..4e60170 100644
--- a/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/layered/LayerAssembler.java
+++ b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/layered/LayerAssembler.java
@@ -22,6 +22,7 @@ package org.apache.polygene.bootstrap.layered;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.LayerAssembly;
 
+@FunctionalInterface
 public interface LayerAssembler
 {
     LayerAssembly assemble( LayerAssembly layer )

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/7956f2d6/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/layered/ModuleAssembler.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/layered/ModuleAssembler.java
b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/layered/ModuleAssembler.java
index 739c3ad..e04321e 100644
--- a/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/layered/ModuleAssembler.java
+++ b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/layered/ModuleAssembler.java
@@ -23,6 +23,7 @@ import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.LayerAssembly;
 import org.apache.polygene.bootstrap.ModuleAssembly;
 
+@FunctionalInterface
 public interface ModuleAssembler
 {
     ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module )


Mime
View raw message