summaryrefslogtreecommitdiffstats
path: root/container-di/src/main/java/com/yahoo/container/di/componentgraph/core/ComponentGraph.java
diff options
context:
space:
mode:
Diffstat (limited to 'container-di/src/main/java/com/yahoo/container/di/componentgraph/core/ComponentGraph.java')
-rw-r--r--container-di/src/main/java/com/yahoo/container/di/componentgraph/core/ComponentGraph.java9
1 files changed, 5 insertions, 4 deletions
diff --git a/container-di/src/main/java/com/yahoo/container/di/componentgraph/core/ComponentGraph.java b/container-di/src/main/java/com/yahoo/container/di/componentgraph/core/ComponentGraph.java
index 76ca94c9286..4a0598d3436 100644
--- a/container-di/src/main/java/com/yahoo/container/di/componentgraph/core/ComponentGraph.java
+++ b/container-di/src/main/java/com/yahoo/container/di/componentgraph/core/ComponentGraph.java
@@ -43,6 +43,7 @@ import static com.yahoo.container.di.componentgraph.core.Exceptions.removeStackT
*/
@NotThreadSafe
public class ComponentGraph {
+
private static final Logger log = Logger.getLogger(ComponentGraph.class.getName());
private long generation;
@@ -107,7 +108,7 @@ public class ComponentGraph {
@SuppressWarnings("unchecked")
public <T> T getInstance(Key<T> key) {
// TODO: Combine exception handling with lookupGlobalComponent.
- Object ob = lookupGlobalComponent(key).map(Node::newOrCachedInstance)
+ Object ob = lookupGlobalComponent(key).map(Node::component)
.orElseThrow(() -> new IllegalStateException(String.format("No global component with key '%s' ", key)));
return (T) ob;
}
@@ -162,8 +163,8 @@ public class ComponentGraph {
}
}
- public Collection<?> allComponentsAndProviders() {
- return nodes().stream().map(node -> node.instance().get()).collect(Collectors.toList());
+ public Collection<?> allConstructedComponentsAndProviders() {
+ return nodes().stream().map(node -> node.constructedInstance().get()).collect(Collectors.toList());
}
private void completeComponentRegistryNode(ComponentRegistryNode registry) {
@@ -243,7 +244,7 @@ public class ComponentGraph {
}
private Optional<GuiceNode> matchingGuiceNode(Key<?> key, Object instance) {
- return matchingNodes(nodes(), GuiceNode.class, key).stream().filter(node -> node.newOrCachedInstance() == instance). // TODO: assert that there is only one (after filter)
+ return matchingNodes(nodes(), GuiceNode.class, key).stream().filter(node -> node.component() == instance). // TODO: assert that there is only one (after filter)
findFirst();
}