package org.grouplens.inject.graph;

import java.lang.reflect.Type;
import java.util.List;
import java.util.Map;

import javax.inject.Provider;

/**
 * A concrete type. It has a set of dependencies which must be satisfied in
 * order to instantiate it. It can also be viewed as an instantiable extension
 * of {@link Type}.
 * 
 * <p>
 * Nodes are expected to provide a reasonable implementation of
 * {@link #equals(Object)} and {@link #hashCode()} so that they can be
 * de-duplicated, etc.
 * 
 * @author Michael Ekstrand <ekstrand@cs.umn.edu>
 * 
 */
public interface Node {
    /**
     * Get this node's dependencies.
     * 
     * @return A list of dependencies which must be satisfied in order to
     *         instantiate this node.
     */
    List<Desire> getDependencies();
    
    /**
     * Create an instance of the type satisfied by this node.
     * 
     * @param dependencies A map of desires to providers of those desires, used
     *        to instantiate the object.
     * @return A new instance of the type represented by this node, with the
     *         specified dependencies injected.
     */
    Object createInstance(Map<Desire, Provider<? extends Object>> dependencies);
}

@@ -87,30 +87,8 @@
 ist;
-%0Aimport java.util.Map;
 %0A%0Aim
@@ -116,16 +116,57 @@
 vider;%0A%0A
+import com.google.common.base.Function;%0A%0A
 /**%0A * A
@@ -809,24 +809,175 @@
    %0A    /**%0A
+     * Get the type of this node.%0A     * %0A     * @return The type of objects to be instantiated by this node.%0A     */%0A    Type getType();%0A    %0A    /**%0A
      * Creat
@@ -1067,14 +1067,24 @@
 s A 
-map of
+function mapping
  des
@@ -1110,25 +1110,11 @@
 f th
-ose desires, used
+eir
 %0A   
@@ -1128,33 +1128,17 @@
     
-to 
 instan
-tiate the object
+ces
 .%0A  
@@ -1260,16 +1260,89 @@
 jected.%0A
+     * @review Consider supporting making Node create %7B@link Provider%7Ds.%0A
      */%0A
@@ -1371,11 +1371,16 @@
 nce(
-Map
+Function
 %3CDes
@@ -1428,9 +1428,8 @@
 cies);%0A%7D
-%0A

Update Node docs & add getType method.