Moving visitors out of Binding so they don't show up in the main com.google.inject package core Javadocs

git-svn-id: https://google-guice.googlecode.com/svn/trunk@581 d779f126-a31b-0410-b53b-1d3aecad763e
diff --git a/src/com/google/inject/Binding.java b/src/com/google/inject/Binding.java
index fd616e3..a512864 100644
--- a/src/com/google/inject/Binding.java
+++ b/src/com/google/inject/Binding.java
@@ -16,9 +16,9 @@
 
 package com.google.inject;
 
+import com.google.inject.spi.BindScopingVisitor;
+import com.google.inject.spi.BindTargetVisitor;
 import com.google.inject.spi.Element;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Constructor;
 
 /**
  * A mapping from a key (type and optional annotation) to the strategy for getting instances of the
@@ -79,125 +79,13 @@
    *
    * @param visitor to call back on
    */
-  <V> V acceptTargetVisitor(TargetVisitor<? super T, V> visitor);
+  <V> V acceptTargetVisitor(BindTargetVisitor<? super T, V> visitor);
 
   /**
    * Accepts a scoping visitor. Invokes the visitor method specific to this binding's scoping.
    *
    * @param visitor to call back on
    */
-  <V> V acceptScopingVisitor(ScopingVisitor<V> visitor);
+  <V> V acceptScopingVisitor(BindScopingVisitor<V> visitor);
 
-  /**
-   * Visits each of the strategies used to find an instance to satisfy an injection.
-   *
-   * @param <V> any type to be returned by the visit method. Use {@link Void} with
-   *     {@code return null} if no return type is needed.
-   */
-  interface TargetVisitor<T, V> {
-
-    /**
-     * Visit a instance binding. The same instance is returned for every injection. This target is
-     * found in both module and injector bindings.
-     *
-     * @param instance the user-supplied value
-     */
-    V visitInstance(T instance);
-
-    /**
-     * Visit a provider instance binding. The provider's {@code get} method is invoked to resolve
-     * injections. This target is found in both module and injector bindings.
-     *
-     * @param provider the user-supplied, unscoped provider
-     */
-    V visitProvider(Provider<? extends T> provider);
-
-    /**
-     * Visit a provider key binding. To resolve injections, the provider injection is first
-     * resolved, then that provider's {@code get} method is invoked. This target is found in both
-     * module and injector bindings.
-     *
-     * @param providerKey the key used to resolve the provider's binding. That binding can be 
-     *      retrieved from an injector using {@link Injector#getBinding(Key)
-     *      Injector.getBinding(providerKey)}
-     */
-    V visitProviderKey(Key<? extends Provider<? extends T>> providerKey);
-
-    /**
-     * Visit a linked key binding. The other key's binding is used to resolve injections. This
-     * target is found in both module and injector bindings.
-     *
-     * @param key the linked key used to resolve injections. That binding can be retrieved from an
-     *      injector using {@link Injector#getBinding(Key) Injector.getBinding(key)}
-     */
-    V visitKey(Key<? extends T> key);
-
-    /**
-     * Visit an untargetted binding. This target is found only on module bindings. It indicates
-     * that the injector should use its implicit binding strategies to resolve injections.
-     */
-    V visitUntargetted();
-
-    /**
-     * Visit a constructor binding. To resolve injections, an instance is instantiated by invoking
-     * {@code constructor}. This target is found only on injector bindings.
-     *
-     * @param constructor the {@link Inject annotated} or default constructor that is invoked for
-     *      creating values
-     */
-    V visitConstructor(Constructor<? extends T> constructor);
-
-    /**
-     * Visit a binding created from converting a bound instance to a new type. The source binding
-     * has the same binding annotation but a different type. This target is found only on injector
-     * bindings.
-     *
-     * @param value the converted value
-     */
-    V visitConvertedConstant(T value);
-
-    /**
-     * Visit a binding to a {@link Provider} that delegates to the binding for the provided type.
-     * This target is found only on injector bindings.
-     *
-     * @param provided the key whose binding is used to {@link Provider#get provide instances}. That
-     *      binding can be retrieved from an injector using {@link Injector#getBinding(Key)
-     *      Injector.getBinding(provided)}
-     */
-    V visitProviderBinding(Key<?> provided);
-  }
-
-  /**
-   * Visits each of the strategies used to scope an injection.
-   *
-   * @param <V> any type to be returned by the visit method. Use {@link Void} with
-   *     {@code return null} if no return type is needed.
-   */
-  interface ScopingVisitor<V> {
-
-    /**
-     * Visit an eager singleton or single instance. This scope strategy is found on both module and
-     * injector bindings.
-     */
-    V visitEagerSingleton();
-
-    /**
-     * Visit a scope instance. This scope strategy is found on both module and injector bindings.
-     */
-    V visitScope(Scope scope);
-
-    /**
-     * Visit a scope annotation. This scope strategy is found only on module bindings. The instance
-     * that implements this scope is registered by {@link Binder#bindScope(Class, Scope)}.
-     */
-    V visitScopeAnnotation(Class<? extends Annotation> scopeAnnotation);
-
-    /**
-     * Visit an unspecified or unscoped strategy. On a module, this strategy indicates that the
-     * injector should use scoping annotations to find a scope. On an injector, it indicates that
-     * no scope is applied to the binding. An unscoped binding will behave like a scoped one when it
-     * is linked to a scoped binding.
-     */
-    V visitNoScoping();
-  }
 }
diff --git a/src/com/google/inject/BindingImpl.java b/src/com/google/inject/BindingImpl.java
index a1990c0..1db2d67 100644
--- a/src/com/google/inject/BindingImpl.java
+++ b/src/com/google/inject/BindingImpl.java
@@ -19,6 +19,7 @@
 import com.google.inject.internal.Errors;
 import com.google.inject.internal.ErrorsException;
 import com.google.inject.internal.ToStringBuilder;
+import com.google.inject.spi.BindScopingVisitor;
 import com.google.inject.spi.Element;
 import com.google.inject.spi.oldversion.OldVersionBinding;
 import com.google.inject.spi.oldversion.ProviderBinding;
@@ -93,7 +94,7 @@
     return visitor.visitBinding(this);
   }
 
-  public <V> V acceptScopingVisitor(ScopingVisitor<V> visitor) {
+  public <V> V acceptScopingVisitor(BindScopingVisitor<V> visitor) {
     if (loadStrategy == LoadStrategy.EAGER) {
       return visitor.visitEagerSingleton();
     } else if (scope != Scopes.NO_SCOPE && scope != null) {
diff --git a/src/com/google/inject/BindingProcessor.java b/src/com/google/inject/BindingProcessor.java
index 6ae857c..efe2861 100644
--- a/src/com/google/inject/BindingProcessor.java
+++ b/src/com/google/inject/BindingProcessor.java
@@ -23,6 +23,8 @@
 import com.google.inject.internal.Errors;
 import com.google.inject.internal.ErrorsException;
 import com.google.inject.internal.StackTraceElements;
+import com.google.inject.spi.BindScopingVisitor;
+import com.google.inject.spi.BindTargetVisitor;
 import java.lang.annotation.Annotation;
 import java.lang.reflect.Constructor;
 import java.lang.reflect.Type;
@@ -39,8 +41,8 @@
  */
 class BindingProcessor extends AbstractProcessor {
 
-  private static final com.google.inject.Binding.ScopingVisitor<LoadStrategy> LOAD_STRATEGY_VISITOR
-      = new com.google.inject.Binding.ScopingVisitor<LoadStrategy>() {
+  private static final BindScopingVisitor<LoadStrategy> LOAD_STRATEGY_VISITOR
+      = new BindScopingVisitor<LoadStrategy>() {
     public LoadStrategy visitEagerSingleton() {
       return LoadStrategy.EAGER;
     }
@@ -96,7 +98,7 @@
     validateKey(command.getSource(), command.getKey());
 
     final LoadStrategy loadStrategy = command.acceptScopingVisitor(LOAD_STRATEGY_VISITOR);
-    final Scope scope = command.acceptScopingVisitor(new com.google.inject.Binding.ScopingVisitor<Scope>() {
+    final Scope scope = command.acceptScopingVisitor(new BindScopingVisitor<Scope>() {
       public Scope visitEagerSingleton() {
         return Scopes.SINGLETON;
       }
@@ -120,7 +122,7 @@
       }
     });
 
-    command.acceptTargetVisitor(new com.google.inject.Binding.TargetVisitor<T, Void>() {
+    command.acceptTargetVisitor(new BindTargetVisitor<T, Void>() {
       public Void visitInstance(T instance) {
         if (instance == null) {
           errors.cannotBindToNullInstance();
diff --git a/src/com/google/inject/ClassBindingImpl.java b/src/com/google/inject/ClassBindingImpl.java
index ee88668..ec03c7a 100644
--- a/src/com/google/inject/ClassBindingImpl.java
+++ b/src/com/google/inject/ClassBindingImpl.java
@@ -20,6 +20,7 @@
 import com.google.inject.internal.Errors;
 import com.google.inject.internal.ErrorsException;
 import com.google.inject.internal.ToStringBuilder;
+import com.google.inject.spi.BindTargetVisitor;
 import com.google.inject.spi.InjectionPoint;
 import com.google.inject.spi.oldversion.BindingVisitor;
 import com.google.inject.spi.oldversion.ClassBinding;
@@ -50,7 +51,7 @@
     visitor.visit(this);
   }
 
-  public <V> V acceptTargetVisitor(TargetVisitor<? super T, V> visitor) {
+  public <V> V acceptTargetVisitor(BindTargetVisitor<? super T, V> visitor) {
     return visitor.visitConstructor(lateBoundConstructor.getConstructor());
   }
 
diff --git a/src/com/google/inject/InjectorImpl.java b/src/com/google/inject/InjectorImpl.java
index f7233da..1f66e55 100644
--- a/src/com/google/inject/InjectorImpl.java
+++ b/src/com/google/inject/InjectorImpl.java
@@ -32,6 +32,7 @@
 import com.google.inject.internal.ReferenceCache;
 import com.google.inject.internal.StackTraceElements;
 import com.google.inject.internal.ToStringBuilder;
+import com.google.inject.spi.BindTargetVisitor;
 import com.google.inject.spi.InjectionPoint;
 import com.google.inject.spi.oldversion.BindingVisitor;
 import com.google.inject.spi.oldversion.ConvertedConstantBinding;
@@ -271,7 +272,7 @@
       bindingVisitor.visit(this);
     }
 
-    public <V> V acceptTargetVisitor(TargetVisitor<? super Provider<T>, V> visitor) {
+    public <V> V acceptTargetVisitor(BindTargetVisitor<? super Provider<T>, V> visitor) {
       return visitor.visitProviderBinding(providedBinding.getKey());
     }
 
@@ -368,7 +369,7 @@
       return value;
     }
 
-    public <V> V acceptTargetVisitor(TargetVisitor<? super T, V> visitor) {
+    public <V> V acceptTargetVisitor(BindTargetVisitor<? super T, V> visitor) {
       return visitor.visitConvertedConstant(value);
     }
 
diff --git a/src/com/google/inject/InstanceBindingImpl.java b/src/com/google/inject/InstanceBindingImpl.java
index 8c99cc1..1643782 100644
--- a/src/com/google/inject/InstanceBindingImpl.java
+++ b/src/com/google/inject/InstanceBindingImpl.java
@@ -19,6 +19,7 @@
 
 import com.google.inject.internal.ErrorsException;
 import com.google.inject.internal.ToStringBuilder;
+import com.google.inject.spi.BindTargetVisitor;
 import com.google.inject.spi.InjectionPoint;
 import com.google.inject.spi.oldversion.BindingVisitor;
 import com.google.inject.spi.oldversion.InstanceBinding;
@@ -46,7 +47,7 @@
     bindingVisitor.visit(this);
   }
 
-  public <V> V acceptTargetVisitor(TargetVisitor<? super T, V> visitor) {
+  public <V> V acceptTargetVisitor(BindTargetVisitor<? super T, V> visitor) {
     return visitor.visitInstance(instance);
   }
 
diff --git a/src/com/google/inject/InvalidBindingImpl.java b/src/com/google/inject/InvalidBindingImpl.java
index 62168c6..0139fea 100644
--- a/src/com/google/inject/InvalidBindingImpl.java
+++ b/src/com/google/inject/InvalidBindingImpl.java
@@ -17,6 +17,7 @@
 package com.google.inject;
 
 import com.google.inject.internal.Errors;
+import com.google.inject.spi.BindTargetVisitor;
 import com.google.inject.spi.InjectionPoint;
 import com.google.inject.spi.oldversion.BindingVisitor;
 
@@ -34,7 +35,7 @@
     throw new AssertionError();
   }
 
-  public <V> V acceptTargetVisitor(TargetVisitor<? super T, V> vVisitor) {
+  public <V> V acceptTargetVisitor(BindTargetVisitor<? super T, V> vVisitor) {
     throw new UnsupportedOperationException();
   }
 
diff --git a/src/com/google/inject/LinkedBindingImpl.java b/src/com/google/inject/LinkedBindingImpl.java
index d88e0e9..36e691f 100644
--- a/src/com/google/inject/LinkedBindingImpl.java
+++ b/src/com/google/inject/LinkedBindingImpl.java
@@ -17,6 +17,7 @@
 package com.google.inject;
 
 import com.google.inject.internal.ToStringBuilder;
+import com.google.inject.spi.BindTargetVisitor;
 import com.google.inject.spi.oldversion.BindingVisitor;
 import com.google.inject.spi.oldversion.LinkedBinding;
 import com.google.inject.spi.oldversion.OldVersionBinding;
@@ -42,7 +43,7 @@
     bindingVisitor.visit(this);
   }
 
-  public <V> V acceptTargetVisitor(TargetVisitor<? super T, V> visitor) {
+  public <V> V acceptTargetVisitor(BindTargetVisitor<? super T, V> visitor) {
     return visitor.visitKey(targetKey);
   }
 
diff --git a/src/com/google/inject/LinkedProviderBindingImpl.java b/src/com/google/inject/LinkedProviderBindingImpl.java
index 7e198e4..6496537 100644
--- a/src/com/google/inject/LinkedProviderBindingImpl.java
+++ b/src/com/google/inject/LinkedProviderBindingImpl.java
@@ -17,6 +17,7 @@
 package com.google.inject;
 
 import com.google.inject.internal.ToStringBuilder;
+import com.google.inject.spi.BindTargetVisitor;
 import com.google.inject.spi.oldversion.BindingVisitor;
 import com.google.inject.spi.oldversion.LinkedProviderBinding;
 import com.google.inject.spi.oldversion.OldVersionBinding;
@@ -46,7 +47,7 @@
     return injector.getBinding(providerKey);
   }
 
-  public <V> V acceptTargetVisitor(TargetVisitor<? super T, V> visitor) {
+  public <V> V acceptTargetVisitor(BindTargetVisitor<? super T, V> visitor) {
     return visitor.visitProviderKey(providerKey);
   }
 
diff --git a/src/com/google/inject/ProviderInstanceBindingImpl.java b/src/com/google/inject/ProviderInstanceBindingImpl.java
index 59490f2..9c8aa87 100644
--- a/src/com/google/inject/ProviderInstanceBindingImpl.java
+++ b/src/com/google/inject/ProviderInstanceBindingImpl.java
@@ -18,6 +18,7 @@
 
 import com.google.inject.internal.ErrorsException;
 import com.google.inject.internal.ToStringBuilder;
+import com.google.inject.spi.BindTargetVisitor;
 import com.google.inject.spi.InjectionPoint;
 import com.google.inject.spi.oldversion.BindingVisitor;
 import com.google.inject.spi.oldversion.ProviderInstanceBinding;
@@ -44,7 +45,7 @@
     bindingVisitor.visit(this);
   }
 
-  public <V> V acceptTargetVisitor(TargetVisitor<? super T, V> visitor) {
+  public <V> V acceptTargetVisitor(BindTargetVisitor<? super T, V> visitor) {
     return visitor.visitProvider(providerInstance);
   }
 
diff --git a/src/com/google/inject/commands/BindTarget.java b/src/com/google/inject/commands/BindTarget.java
index 88d8117..e36fea0 100644
--- a/src/com/google/inject/commands/BindTarget.java
+++ b/src/com/google/inject/commands/BindTarget.java
@@ -26,7 +26,7 @@
 /**
  * A binding target, which provides instances from a specific key. 
  *
- * @deprecated replaced with {@link com.google.inject.Binding.TargetVisitor}
+ * @deprecated replaced with {@link com.google.inject.spi.BindTargetVisitor}
  *
  * @author jessewilson@google.com (Jesse Wilson)
  */
diff --git a/src/com/google/inject/internal/ModuleBinding.java b/src/com/google/inject/internal/ModuleBinding.java
index 9a1bcec..716aac7 100644
--- a/src/com/google/inject/internal/ModuleBinding.java
+++ b/src/com/google/inject/internal/ModuleBinding.java
@@ -28,6 +28,8 @@
 import com.google.inject.binder.ConstantBindingBuilder;
 import com.google.inject.binder.LinkedBindingBuilder;
 import com.google.inject.binder.ScopedBindingBuilder;
+import com.google.inject.spi.BindScopingVisitor;
+import com.google.inject.spi.BindTargetVisitor;
 import com.google.inject.spi.DefaultBindTargetVisitor;
 import java.lang.annotation.Annotation;
 
@@ -41,18 +43,18 @@
   private final Key<?> NULL_KEY = Key.get(Void.class);
 
   private static final Target<Object> EMPTY_TARGET = new Target<Object>() {
-    public <V> V acceptTargetVisitor(TargetVisitor<? super Object, V> visitor) {
+    public <V> V acceptTargetVisitor(BindTargetVisitor<? super Object, V> visitor) {
       return visitor.visitUntargetted();
     }
   };
 
   private static final Scoping EMPTY_SCOPING = new AbstractScoping() {
-    public <V> V acceptVisitor(ScopingVisitor<V> visitor) {
+    public <V> V acceptVisitor(BindScopingVisitor<V> visitor) {
       return visitor.visitNoScoping();
     }
   };
 
-  private static final TargetVisitor<Object, Boolean> SUPPORTS_SCOPES
+  private static final BindTargetVisitor<Object, Boolean> SUPPORTS_SCOPES
       = new DefaultBindTargetVisitor<Object, Boolean>() {
     @Override public Boolean visitInstance(Object instance) {
       return false;
@@ -103,11 +105,11 @@
     return key;
   }
 
-  public <V> V acceptTargetVisitor(TargetVisitor<? super T, V> visitor) {
+  public <V> V acceptTargetVisitor(BindTargetVisitor<? super T, V> visitor) {
     return target.acceptTargetVisitor(visitor);
   }
 
-  public <V> V acceptScopingVisitor(ScopingVisitor<V> visitor) {
+  public <V> V acceptScopingVisitor(BindScopingVisitor<V> visitor) {
     return scoping.acceptVisitor(visitor);
   }
 
@@ -172,7 +174,7 @@
       checkNotNull(targetKey, "targetKey");
       checkNotTargetted();
       target = new Target<T>() {
-        public <V> V acceptTargetVisitor(TargetVisitor<? super T, V> visitor) {
+        public <V> V acceptTargetVisitor(BindTargetVisitor<? super T, V> visitor) {
           return visitor.visitKey(targetKey);
         }
         @Override public String toString() {
@@ -191,7 +193,7 @@
       checkNotNull(provider, "provider");
       checkNotTargetted();
       target = new Target<T>() {
-        public <V> V acceptTargetVisitor(TargetVisitor<? super T, V> visitor) {
+        public <V> V acceptTargetVisitor(BindTargetVisitor<? super T, V> visitor) {
           return visitor.visitProvider(provider);
         }
       };
@@ -208,7 +210,7 @@
       checkNotNull(providerKey, "providerKey");
       checkNotTargetted();
       target = new Target<T>() {
-        public <V> V acceptTargetVisitor(TargetVisitor<? super T, V> visitor) {
+        public <V> V acceptTargetVisitor(BindTargetVisitor<? super T, V> visitor) {
           return visitor.visitProviderKey(providerKey);
         }
       };
@@ -223,7 +225,7 @@
         @Override public Class<? extends Annotation> getScopeAnnotation() {
           return scopeAnnotation;
         }
-        public <V> V acceptVisitor(ScopingVisitor<V> visitor) {
+        public <V> V acceptVisitor(BindScopingVisitor<V> visitor) {
           return visitor.visitScopeAnnotation(scopeAnnotation);
         }
         @Override public String toString() {
@@ -239,7 +241,7 @@
         @Override public Scope getScope() {
           return scope;
         }
-        public <V> V acceptVisitor(ScopingVisitor<V> visitor) {
+        public <V> V acceptVisitor(BindScopingVisitor<V> visitor) {
           return visitor.visitScope(scope);
         }
         @Override public String toString() {
@@ -251,7 +253,7 @@
     public void asEagerSingleton() {
       checkNotScoped();
       scoping = new AbstractScoping() {
-        public <V> V acceptVisitor(ScopingVisitor<V> visitor) {
+        public <V> V acceptVisitor(BindScopingVisitor<V> visitor) {
           return visitor.visitEagerSingleton();
         }
         @Override public String toString() {
@@ -281,8 +283,8 @@
     }
 
     private void checkNotScoped() {
-      @SuppressWarnings("unchecked") TargetVisitor<T,Boolean> supportsScopesOfT
-          = (TargetVisitor<T,Boolean>) SUPPORTS_SCOPES;
+      @SuppressWarnings("unchecked") BindTargetVisitor<T,Boolean> supportsScopesOfT
+          = (BindTargetVisitor<T,Boolean>) SUPPORTS_SCOPES;
 
       // Scoping isn't allowed when we have only one instance.
       if (!target.acceptTargetVisitor(supportsScopesOfT)) {
@@ -417,12 +419,12 @@
 
   /** A binding target, which provides instances from a specific key. */
   private interface Target<T> {
-    <V> V acceptTargetVisitor(TargetVisitor<? super T, V> visitor);
+    <V> V acceptTargetVisitor(BindTargetVisitor<? super T, V> visitor);
   }
 
   /** Immutable snapshot of a binding scope. */
   private interface Scoping {
-    <V> V acceptVisitor(ScopingVisitor<V> visitor);
+    <V> V acceptVisitor(BindScopingVisitor<V> visitor);
   }
 
   static class InstanceTarget<T> implements Target<T> {
@@ -432,7 +434,7 @@
       this.instance = instance;
     }
 
-    public <V> V acceptTargetVisitor(TargetVisitor<? super T, V> visitor) {
+    public <V> V acceptTargetVisitor(BindTargetVisitor<? super T, V> visitor) {
       return visitor.visitInstance(instance);
     }
   }
diff --git a/src/com/google/inject/spi/BindScopingVisitor.java b/src/com/google/inject/spi/BindScopingVisitor.java
new file mode 100644
index 0000000..1c76ae0
--- /dev/null
+++ b/src/com/google/inject/spi/BindScopingVisitor.java
@@ -0,0 +1,55 @@
+/**
+ * Copyright (C) 2008 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.inject.spi;
+
+import com.google.inject.Scope;
+import java.lang.annotation.Annotation;
+
+/**
+ * Visits each of the strategies used to scope an injection.
+ *
+ * @param <V> any type to be returned by the visit method. Use {@link Void} with
+ *     {@code return null} if no return type is needed.
+ */
+public interface BindScopingVisitor<V> {
+
+  /**
+   * Visit an eager singleton or single instance. This scope strategy is found on both module and
+   * injector bindings.
+   */
+  V visitEagerSingleton();
+
+  /**
+   * Visit a scope instance. This scope strategy is found on both module and injector bindings.
+   */
+  V visitScope(Scope scope);
+
+  /**
+   * Visit a scope annotation. This scope strategy is found only on module bindings. The instance
+   * that implements this scope is registered by {@link com.google.inject.Binder#bindScope(Class,
+   * Scope) Binder.bindScope()}.
+   */
+  V visitScopeAnnotation(Class<? extends Annotation> scopeAnnotation);
+
+  /**
+   * Visit an unspecified or unscoped strategy. On a module, this strategy indicates that the
+   * injector should use scoping annotations to find a scope. On an injector, it indicates that
+   * no scope is applied to the binding. An unscoped binding will behave like a scoped one when it
+   * is linked to a scoped binding.
+   */
+  V visitNoScoping();
+}
diff --git a/src/com/google/inject/spi/BindTargetVisitor.java b/src/com/google/inject/spi/BindTargetVisitor.java
new file mode 100644
index 0000000..e7dc547
--- /dev/null
+++ b/src/com/google/inject/spi/BindTargetVisitor.java
@@ -0,0 +1,100 @@
+/**
+ * Copyright (C) 2008 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.inject.spi;
+
+import com.google.inject.Key;
+import com.google.inject.Provider;
+import java.lang.reflect.Constructor;
+
+/**
+ * Visits each of the strategies used to find an instance to satisfy an injection.
+ *
+ * @param <V> any type to be returned by the visit method. Use {@link Void} with
+ *     {@code return null} if no return type is needed.
+ */
+public interface BindTargetVisitor<T, V> {
+
+  /**
+   * Visit a instance binding. The same instance is returned for every injection. This target is
+   * found in both module and injector bindings.
+   *
+   * @param instance the user-supplied value
+   */
+  V visitInstance(T instance);
+
+  /**
+   * Visit a provider instance binding. The provider's {@code get} method is invoked to resolve
+   * injections. This target is found in both module and injector bindings.
+   *
+   * @param provider the user-supplied, unscoped provider
+   */
+  V visitProvider(Provider<? extends T> provider);
+
+  /**
+   * Visit a provider key binding. To resolve injections, the provider injection is first
+   * resolved, then that provider's {@code get} method is invoked. This target is found in both
+   * module and injector bindings.
+   *
+   * @param providerKey the key used to resolve the provider's binding. That binding can be
+   *      retrieved from an injector using {@link com.google.inject.Injector#getBinding(Key)
+   *      Injector.getBinding(providerKey)}
+   */
+  V visitProviderKey(Key<? extends Provider<? extends T>> providerKey);
+
+  /**
+   * Visit a linked key binding. The other key's binding is used to resolve injections. This
+   * target is found in both module and injector bindings.
+   *
+   * @param key the linked key used to resolve injections. That binding can be retrieved from an
+   *      injector using {@link com.google.inject.Injector#getBinding(Key) Injector.getBinding(key)}
+   */
+  V visitKey(Key<? extends T> key);
+
+  /**
+   * Visit an untargetted binding. This target is found only on module bindings. It indicates
+   * that the injector should use its implicit binding strategies to resolve injections.
+   */
+  V visitUntargetted();
+
+  /**
+   * Visit a constructor binding. To resolve injections, an instance is instantiated by invoking
+   * {@code constructor}. This target is found only on injector bindings.
+   *
+   * @param constructor the {@link com.google.inject.Inject annotated} or default constructor that
+   *      is invoked for creating values
+   */
+  V visitConstructor(Constructor<? extends T> constructor);
+
+  /**
+   * Visit a binding created from converting a bound instance to a new type. The source binding
+   * has the same binding annotation but a different type. This target is found only on injector
+   * bindings.
+   *
+   * @param value the converted value
+   */
+  V visitConvertedConstant(T value);
+
+  /**
+   * Visit a binding to a {@link com.google.inject.Provider} that delegates to the binding for the
+   * provided type. This target is found only on injector bindings.
+   *
+   * @param provided the key whose binding is used to {@link com.google.inject.Provider#get provide
+   *      instances}. That binding can be retrieved from an injector using {@link
+   *      com.google.inject.Injector#getBinding(Key) Injector.getBinding(provided)}
+   */
+  V visitProviderBinding(Key<?> provided);
+}
diff --git a/src/com/google/inject/spi/DefaultBindTargetVisitor.java b/src/com/google/inject/spi/DefaultBindTargetVisitor.java
index 54a6597..03e4a6b 100644
--- a/src/com/google/inject/spi/DefaultBindTargetVisitor.java
+++ b/src/com/google/inject/spi/DefaultBindTargetVisitor.java
@@ -16,12 +16,16 @@
 
 package com.google.inject.spi;
 
-import com.google.inject.Binding.TargetVisitor;
 import com.google.inject.Key;
 import com.google.inject.Provider;
 import java.lang.reflect.Constructor;
 
-public class DefaultBindTargetVisitor<T, V> implements TargetVisitor<T, V> {
+/**
+ * No-op visitor for subclassing.
+ *
+ * @author jessewilson@google.com (Jesse Wilson)
+ */
+public class DefaultBindTargetVisitor<T, V> implements BindTargetVisitor<T, V> {
 
   protected V visitOther() {
     return null;
diff --git a/src/com/google/inject/spi/Element.java b/src/com/google/inject/spi/Element.java
index 182161b..0f2c040 100644
--- a/src/com/google/inject/spi/Element.java
+++ b/src/com/google/inject/spi/Element.java
@@ -22,12 +22,12 @@
  * A core component of a module or injector.
  *
  * <p>The elements of a module can be inspected, validated and rewritten. Use {@link
- * Elements#getElements(com.google.inject.Module[])} to read the elements from a module, and
- * {@link com.google.inject.spi.ModuleWriter} to rewrite them. This can be used for static analysis
- * and generation of Guice modules.
+ * Elements#getElements(com.google.inject.Module[]) Elements.getElements()} to read the elements
+ * from a module, and {@link com.google.inject.spi.ModuleWriter} to rewrite them. This can be used
+ * for static analysis and generation of Guice modules.
  *
  * <p>The elements of an injector can be inspected and exercised. Use {@link
- * com.google.inject.Injector#getBindings} to reflect on Guice injectors.
+ * com.google.inject.Injector#getBindings Injector.getBindings()} to reflect on Guice injectors.
  *
  * @author jessewilson@google.com (Jesse Wilson)
  */
diff --git a/src/com/google/inject/spi/Elements.java b/src/com/google/inject/spi/Elements.java
index 09be0d5..5a82949 100644
--- a/src/com/google/inject/spi/Elements.java
+++ b/src/com/google/inject/spi/Elements.java
@@ -22,7 +22,6 @@
 import com.google.common.collect.Sets;
 import com.google.inject.AbstractModule;
 import com.google.inject.Binder;
-import com.google.inject.Binding.TargetVisitor;
 import com.google.inject.Key;
 import com.google.inject.Module;
 import com.google.inject.Provider;
@@ -49,7 +48,7 @@
  * @author jessewilson@google.com (Jesse Wilson)
  */
 public final class Elements {
-  private static final TargetVisitor<Object, Object> GET_INSTANCE_VISITOR
+  private static final BindTargetVisitor<Object, Object> GET_INSTANCE_VISITOR
       = new DefaultBindTargetVisitor<Object, Object>() {
     @Override public Object visitInstance(Object instance) {
       return instance;
@@ -93,8 +92,8 @@
   }
 
   @SuppressWarnings("unchecked")
-  public static <T> com.google.inject.Binding.TargetVisitor<T, T> getInstanceVisitor() {
-    return (com.google.inject.Binding.TargetVisitor<T, T>) GET_INSTANCE_VISITOR;
+  public static <T> BindTargetVisitor<T, T> getInstanceVisitor() {
+    return (BindTargetVisitor<T, T>) GET_INSTANCE_VISITOR;
   }
 
   private static class RecordingBinder implements Binder {
diff --git a/src/com/google/inject/spi/ModuleWriter.java b/src/com/google/inject/spi/ModuleWriter.java
index 61e76bf..beae501 100644
--- a/src/com/google/inject/spi/ModuleWriter.java
+++ b/src/com/google/inject/spi/ModuleWriter.java
@@ -151,7 +151,7 @@
    */
   public <T> ScopedBindingBuilder applyTarget(Binding<T> binding,
       final LinkedBindingBuilder<T> linkedBindingBuilder) {
-    return binding.acceptTargetVisitor(new com.google.inject.Binding.TargetVisitor<T, ScopedBindingBuilder>() {
+    return binding.acceptTargetVisitor(new BindTargetVisitor<T, ScopedBindingBuilder>() {
       public ScopedBindingBuilder visitInstance(T instance) {
         linkedBindingBuilder.toInstance(instance);
         return null;
@@ -188,7 +188,7 @@
   }
 
   public void applyScoping(Binding<?> binding, final ScopedBindingBuilder scopedBindingBuilder) {
-    binding.acceptScopingVisitor(new com.google.inject.Binding.ScopingVisitor<Void>() {
+    binding.acceptScopingVisitor(new BindScopingVisitor<Void>() {
       public Void visitEagerSingleton() {
         scopedBindingBuilder.asEagerSingleton();
         return null;
diff --git a/src/com/google/inject/spi/oldversion/ClassBinding.java b/src/com/google/inject/spi/oldversion/ClassBinding.java
index 4ba8a48..c797e95 100644
--- a/src/com/google/inject/spi/oldversion/ClassBinding.java
+++ b/src/com/google/inject/spi/oldversion/ClassBinding.java
@@ -25,7 +25,7 @@
  * <p>Example: {@code bind(Concrete.class);}
  *
  * @deprecated replaced with {@link
- * com.google.inject.Binding.TargetVisitor#visitConstructor(java.lang.reflect.Constructor)}
+ * com.google.inject.spi.BindTargetVisitor#visitConstructor(java.lang.reflect.Constructor)}
  *
  * @author crazybob@google.com (Bob Lee)
  */
diff --git a/src/com/google/inject/spi/oldversion/ConvertedConstantBinding.java b/src/com/google/inject/spi/oldversion/ConvertedConstantBinding.java
index 94a6521..6a63ad4 100644
--- a/src/com/google/inject/spi/oldversion/ConvertedConstantBinding.java
+++ b/src/com/google/inject/spi/oldversion/ConvertedConstantBinding.java
@@ -20,7 +20,7 @@
  * A binding which was converted from a string contant.
  *
  * @deprecated replaced with {@link
- * com.google.inject.Binding.TargetVisitor#visitConvertedConstant(Object)}
+ * com.google.inject.spi.BindTargetVisitor#visitConvertedConstant(Object)}
  *
  * @author crazybob@google.com (Bob Lee)
  */
diff --git a/src/com/google/inject/spi/oldversion/InstanceBinding.java b/src/com/google/inject/spi/oldversion/InstanceBinding.java
index 22ec867..4d76dd3 100644
--- a/src/com/google/inject/spi/oldversion/InstanceBinding.java
+++ b/src/com/google/inject/spi/oldversion/InstanceBinding.java
@@ -27,7 +27,7 @@
  * </pre>
  *
  * @deprecated replaced with {@link
- * com.google.inject.Binding.TargetVisitor#visitInstance(Object)}
+ * com.google.inject.spi.BindTargetVisitor#visitInstance(Object)}
  *
  * @author crazybob@google.com (Bob Lee)
  */
diff --git a/src/com/google/inject/spi/oldversion/LinkedBinding.java b/src/com/google/inject/spi/oldversion/LinkedBinding.java
index 552876b..095c1c1 100644
--- a/src/com/google/inject/spi/oldversion/LinkedBinding.java
+++ b/src/com/google/inject/spi/oldversion/LinkedBinding.java
@@ -22,7 +22,7 @@
  * <p>Example: {@code bind(Collection.class).to(List.class);}
  *
  * @deprecated replaced with {@link
- * com.google.inject.Binding.TargetVisitor#visitKey(com.google.inject.Key)}
+ * com.google.inject.spi.BindTargetVisitor#visitKey(com.google.inject.Key)}
  *
  * @author crazybob@google.com (Bob Lee)
  */
diff --git a/src/com/google/inject/spi/oldversion/LinkedProviderBinding.java b/src/com/google/inject/spi/oldversion/LinkedProviderBinding.java
index 2ea8ee9..2e601f6 100644
--- a/src/com/google/inject/spi/oldversion/LinkedProviderBinding.java
+++ b/src/com/google/inject/spi/oldversion/LinkedProviderBinding.java
@@ -25,7 +25,7 @@
  * <p>Example: {@code bind(Foo.class).toProvider(FooProvider.class);}
  *
  * @deprecated replaced with {@link
- * com.google.inject.Binding.TargetVisitor#visitProviderKey(com.google.inject.Key)}
+ * com.google.inject.spi.BindTargetVisitor#visitProviderKey(com.google.inject.Key)}
  *
  * @author crazybob@google.com (Bob Lee)
  */
diff --git a/src/com/google/inject/spi/oldversion/ProviderBinding.java b/src/com/google/inject/spi/oldversion/ProviderBinding.java
index b12cc48..4531b5d 100644
--- a/src/com/google/inject/spi/oldversion/ProviderBinding.java
+++ b/src/com/google/inject/spi/oldversion/ProviderBinding.java
@@ -23,7 +23,7 @@
  * {@code T}.
  *
  * @deprecated replaced with {@link 
- * com.google.inject.Binding.TargetVisitor#visitProviderBinding(com.google.inject.Key)}
+ * com.google.inject.spi.BindTargetVisitor#visitProviderBinding(com.google.inject.Key)}
  *
  * @author crazybob@google.com (Bob Lee)
  */
diff --git a/src/com/google/inject/spi/oldversion/ProviderInstanceBinding.java b/src/com/google/inject/spi/oldversion/ProviderInstanceBinding.java
index 7d8e139..0eaaff3 100644
--- a/src/com/google/inject/spi/oldversion/ProviderInstanceBinding.java
+++ b/src/com/google/inject/spi/oldversion/ProviderInstanceBinding.java
@@ -25,7 +25,7 @@
  * <p>Example: {@code bind(Foo.class).toProvider(new FooProvider());}
  *
  * @deprecated replaced with {@link
- * com.google.inject.Binding.TargetVisitor#visitProvider(com.google.inject.Provider)}
+ * com.google.inject.spi.BindTargetVisitor#visitProvider(com.google.inject.Provider)}
  *
  * @author crazybob@google.com (Bob Lee)
  */