You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@polygene.apache.org by pa...@apache.org on 2017/05/15 11:03:07 UTC
[02/50] polygene-java git commit: :tutorials:hello refine
:tutorials:hello refine
Project: http://git-wip-us.apache.org/repos/asf/polygene-java/repo
Commit: http://git-wip-us.apache.org/repos/asf/polygene-java/commit/779e8553
Tree: http://git-wip-us.apache.org/repos/asf/polygene-java/tree/779e8553
Diff: http://git-wip-us.apache.org/repos/asf/polygene-java/diff/779e8553
Branch: refs/heads/develop
Commit: 779e8553fdca8a0de648617dc41edf3407be4dad
Parents: ee44495
Author: Paul Merlin <pa...@apache.org>
Authored: Mon May 15 09:06:26 2017 +0200
Committer: Paul Merlin <pa...@apache.org>
Committed: Mon May 15 09:06:26 2017 +0200
----------------------------------------------------------------------
.../org/apache/polygene/tutorials/hello/Hello.java | 16 +++++++---------
.../apache/polygene/tutorials/hello/HelloTest.java | 2 --
2 files changed, 7 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/779e8553/tutorials/hello/src/main/java/org/apache/polygene/tutorials/hello/Hello.java
----------------------------------------------------------------------
diff --git a/tutorials/hello/src/main/java/org/apache/polygene/tutorials/hello/Hello.java b/tutorials/hello/src/main/java/org/apache/polygene/tutorials/hello/Hello.java
index cf0f58f..f0fd7e4 100644
--- a/tutorials/hello/src/main/java/org/apache/polygene/tutorials/hello/Hello.java
+++ b/tutorials/hello/src/main/java/org/apache/polygene/tutorials/hello/Hello.java
@@ -19,7 +19,6 @@
*/
package org.apache.polygene.tutorials.hello;
-import org.apache.polygene.api.common.UseDefaults;
import org.apache.polygene.api.injection.scope.This;
import org.apache.polygene.api.mixin.Mixins;
import org.apache.polygene.api.property.Property;
@@ -28,10 +27,10 @@ import org.apache.polygene.library.constraints.annotation.NotEmpty;
// START SNIPPET: body
/**
- * This Composite interface declares a simple "Hello World" interface with a single say() method. What is being
- * said is defined in the HelloWorldState interface, which is a private mixin.
+ * This Composite interface declares a simple "Hello World" interface with a single say() method.
+ * What is being said is defined in the HelloWorldState interface, which is a private mixin.
*/
-@Mixins( { Hello.HelloWorldMixin.class } )
+@Mixins( Hello.HelloWorldMixin.class )
public interface Hello
{
String say();
@@ -39,10 +38,11 @@ public interface Hello
/**
* This is the implementation of the say() method.
*/
- public abstract class HelloWorldMixin
+ class HelloWorldMixin
implements Hello
{
- // @This reference the composite itself, and since HelloWorldState is not part of the public interface,
+ // @This reference the composite itself,
+ // and since HelloWorldState is not part of the public interface,
// it is a private mixin.
@This
private State state;
@@ -57,14 +57,12 @@ public interface Hello
/**
* This interface contains only the state of the HelloWorld object.
*/
- public interface State
+ interface State
{
@NotEmpty
- @UseDefaults
Property<String> phrase();
@NotEmpty
- @UseDefaults
Property<String> name();
}
}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/779e8553/tutorials/hello/src/test/java/org/apache/polygene/tutorials/hello/HelloTest.java
----------------------------------------------------------------------
diff --git a/tutorials/hello/src/test/java/org/apache/polygene/tutorials/hello/HelloTest.java b/tutorials/hello/src/test/java/org/apache/polygene/tutorials/hello/HelloTest.java
index d752fdd..4a2453f 100644
--- a/tutorials/hello/src/test/java/org/apache/polygene/tutorials/hello/HelloTest.java
+++ b/tutorials/hello/src/test/java/org/apache/polygene/tutorials/hello/HelloTest.java
@@ -22,7 +22,6 @@ package org.apache.polygene.tutorials.hello;
import org.apache.polygene.test.AbstractPolygeneTest;
import org.junit.Test;
import org.apache.polygene.api.value.ValueBuilder;
-import org.apache.polygene.bootstrap.AssemblyException;
import org.apache.polygene.bootstrap.ModuleAssembly;
import static org.hamcrest.CoreMatchers.equalTo;
@@ -36,7 +35,6 @@ public class HelloTest extends AbstractPolygeneTest
// START SNIPPET: step2
@Override
public void assemble( ModuleAssembly module )
- throws AssemblyException
{
module.values( Hello.class );
}