polygene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nic...@apache.org
Subject [3/4] polygene-java git commit: POLYGENE-278 : Adding "uses" to CompositeContext
Date Sun, 03 Dec 2017 06:08:10 GMT
POLYGENE-278 : Adding "uses" to CompositeContext


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

Branch: refs/heads/develop
Commit: 52c7050cd2d77c43a3b8df97bff85ae5d55db3ab
Parents: f2d8338
Author: niclas <niclas@hedhman.org>
Authored: Sat Dec 2 17:10:56 2017 +0800
Committer: niclas <niclas@hedhman.org>
Committed: Sat Dec 2 17:10:56 2017 +0800

----------------------------------------------------------------------
 .../polygene/api/composite/CompositeContext.java   | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/polygene-java/blob/52c7050c/core/api/src/main/java/org/apache/polygene/api/composite/CompositeContext.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/composite/CompositeContext.java
b/core/api/src/main/java/org/apache/polygene/api/composite/CompositeContext.java
index 6c32c81..da3b4e5 100644
--- a/core/api/src/main/java/org/apache/polygene/api/composite/CompositeContext.java
+++ b/core/api/src/main/java/org/apache/polygene/api/composite/CompositeContext.java
@@ -36,19 +36,30 @@ import org.apache.polygene.api.structure.ModuleDescriptor;
 public class CompositeContext<T extends TransientComposite>
     extends ThreadLocal<T>
 {
-    private ModuleDescriptor module;
-    private Class<T> type;
+    private static final Object[] EMPTY = new Object[0];
+
+    private final ModuleDescriptor module;
+    private final Class<T> type;
+    private final Object[] uses;
 
     public CompositeContext( ModuleDescriptor module, Class<T> type )
     {
         this.module = module;
         this.type = type;
+        uses = EMPTY;
+    }
+
+    public CompositeContext( ModuleDescriptor module, Class<T> type, Object... uses
)
+    {
+        this.module = module;
+        this.type = type;
+        this.uses = uses;
     }
 
     @Override
     protected T initialValue()
     {
-        return module.instance().newTransient( type );
+        return module.instance().newTransient( type, uses );
     }
 
     @SuppressWarnings( "unchecked" )


Mime
View raw message