polygene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From paulmer...@apache.org
Subject [07/13] polygene-java git commit: Prefer SingletonAssembler lambda ctor over anonymous override
Date Fri, 26 May 2017 15:00:22 GMT
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/2a2a28b8/tutorials/composites/src/test/java/org/apache/polygene/tutorials/composites/tutorial8/HelloWorldTest.java
----------------------------------------------------------------------
diff --git a/tutorials/composites/src/test/java/org/apache/polygene/tutorials/composites/tutorial8/HelloWorldTest.java
b/tutorials/composites/src/test/java/org/apache/polygene/tutorials/composites/tutorial8/HelloWorldTest.java
index e8a753b..4555a44 100644
--- a/tutorials/composites/src/test/java/org/apache/polygene/tutorials/composites/tutorial8/HelloWorldTest.java
+++ b/tutorials/composites/src/test/java/org/apache/polygene/tutorials/composites/tutorial8/HelloWorldTest.java
@@ -19,13 +19,11 @@
  */
 package org.apache.polygene.tutorials.composites.tutorial8;
 
-import org.junit.Before;
-import org.junit.Test;
 import org.apache.polygene.api.composite.TransientBuilder;
 import org.apache.polygene.api.composite.TransientBuilderFactory;
-import org.apache.polygene.bootstrap.AssemblyException;
-import org.apache.polygene.bootstrap.ModuleAssembly;
 import org.apache.polygene.bootstrap.SingletonAssembler;
+import org.junit.Before;
+import org.junit.Test;
 
 import static org.hamcrest.CoreMatchers.equalTo;
 import static org.junit.Assert.assertThat;
@@ -39,15 +37,9 @@ public class HelloWorldTest
     public void setUp()
         throws Exception
     {
-        SingletonAssembler assembly = new SingletonAssembler()
-        {
-            @Override
-            public void assemble( ModuleAssembly module )
-                throws AssemblyException
-            {
-                module.transients( HelloWorldComposite.class );
-            }
-        };
+        SingletonAssembler assembly = new SingletonAssembler(
+            module -> module.transients( HelloWorldComposite.class )
+        );
         TransientBuilderFactory builderFactory = assembly.module();
         TransientBuilder<HelloWorldComposite> builder = builderFactory.newTransientBuilder(
HelloWorldComposite.class );
         builder.prototype().name().set( "Hello" );

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/2a2a28b8/tutorials/composites/src/test/java/org/apache/polygene/tutorials/composites/tutorial9/HelloWorldTest.java
----------------------------------------------------------------------
diff --git a/tutorials/composites/src/test/java/org/apache/polygene/tutorials/composites/tutorial9/HelloWorldTest.java
b/tutorials/composites/src/test/java/org/apache/polygene/tutorials/composites/tutorial9/HelloWorldTest.java
index 37384f9..b3c4d3b 100644
--- a/tutorials/composites/src/test/java/org/apache/polygene/tutorials/composites/tutorial9/HelloWorldTest.java
+++ b/tutorials/composites/src/test/java/org/apache/polygene/tutorials/composites/tutorial9/HelloWorldTest.java
@@ -19,13 +19,11 @@
  */
 package org.apache.polygene.tutorials.composites.tutorial9;
 
-import org.junit.Before;
-import org.junit.Test;
 import org.apache.polygene.api.composite.TransientBuilder;
 import org.apache.polygene.api.composite.TransientBuilderFactory;
-import org.apache.polygene.bootstrap.AssemblyException;
-import org.apache.polygene.bootstrap.ModuleAssembly;
 import org.apache.polygene.bootstrap.SingletonAssembler;
+import org.junit.Before;
+import org.junit.Test;
 
 import static org.hamcrest.CoreMatchers.equalTo;
 import static org.junit.Assert.assertThat;
@@ -39,15 +37,9 @@ public class HelloWorldTest
     public void setUp()
         throws Exception
     {
-        SingletonAssembler assembly = new SingletonAssembler()
-        {
-            @Override
-            public void assemble( ModuleAssembly module )
-                throws AssemblyException
-            {
-                module.transients( HelloWorldComposite.class );
-            }
-        };
+        SingletonAssembler assembly = new SingletonAssembler(
+            module -> module.transients( HelloWorldComposite.class )
+        );
         TransientBuilderFactory builderFactory = assembly.module();
         TransientBuilder<HelloWorldComposite> builder = builderFactory.newTransientBuilder(
HelloWorldComposite.class );
         builder.prototype().name().set( "Hello" );


Mime
View raw message