New names for the core elements:
 - Binding
 - TypeConverterBinding
 - ScopeBinding
 - InterceptorBinding
 - InjectionRequest
 - StaticInjectionRequest
 - ProviderLookup
 - Message

The only names I'm unhappy with are ScopeBinding and TypeConverterBinding, since these have nothing to do with the other Binding type. I was also considering TypeConverterRegistration and ScopeRegistration, but the word registration makes me feel icky.

git-svn-id: https://google-guice.googlecode.com/svn/trunk@577 d779f126-a31b-0410-b53b-1d3aecad763e
diff --git a/src/com/google/inject/AbstractProcessor.java b/src/com/google/inject/AbstractProcessor.java
new file mode 100644
index 0000000..fbeea9a
--- /dev/null
+++ b/src/com/google/inject/AbstractProcessor.java
@@ -0,0 +1,95 @@
+/**
+ * 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;
+
+import com.google.inject.internal.Errors;
+import com.google.inject.spi.Element;
+import com.google.inject.spi.InjectionRequest;
+import com.google.inject.spi.InterceptorBinding;
+import com.google.inject.spi.Message;
+import com.google.inject.spi.ProviderLookup;
+import com.google.inject.spi.ScopeBinding;
+import com.google.inject.spi.StaticInjectionRequest;
+import com.google.inject.spi.TypeConverterBinding;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * Abstract base class for creating an injector from module elements.
+ *
+ * <p>Extending classes must return {@code true} from any overridden
+ * {@code visit*()} methods, in order for the element processor to remove the
+ * handled element.
+ *
+ * @author jessewilson@google.com (Jesse Wilson)
+ */
+abstract class AbstractProcessor implements Element.Visitor<Boolean> {
+
+  protected Errors errors;
+
+  protected AbstractProcessor(Errors errors) {
+    this.errors = errors;
+  }
+
+  public void processCommands(List<Element> elements) {
+    Errors errorsAnyElement = this.errors;
+    try {
+      for (Iterator<Element> i = elements.iterator(); i.hasNext(); ) {
+        Element element = i.next();
+        this.errors = errorsAnyElement.withSource(element.getSource());
+        Boolean allDone = element.acceptVisitor(this);
+        if (allDone) {
+          i.remove();
+        }
+      }
+    } finally {
+      this.errors = errorsAnyElement;
+    }
+  }
+
+  public Boolean visitMessage(Message message) {
+    return false;
+  }
+
+  public Boolean visitInterceptorBinding(InterceptorBinding interceptorBinding) {
+    return false;
+  }
+
+  public Boolean visitScopeBinding(ScopeBinding scopeBinding) {
+    return false;
+  }
+
+  public Boolean visitInjectionRequest(InjectionRequest injectionRequest) {
+    return false;
+  }
+
+  public Boolean visitStaticInjectionRequest(StaticInjectionRequest staticInjectionRequest) {
+    return false;
+  }
+
+  public Boolean visitTypeConverterBinding(TypeConverterBinding typeConverterBinding) {
+    return false;
+  }
+
+  public <T> Boolean visitBinding(Binding<T> binding) {
+    return false;
+  }
+
+  public <T> Boolean visitProviderLookup(ProviderLookup<T> providerLookup) {
+    return false;
+  }
+}
diff --git a/src/com/google/inject/Binding.java b/src/com/google/inject/Binding.java
index e44bbd3..fd616e3 100644
--- a/src/com/google/inject/Binding.java
+++ b/src/com/google/inject/Binding.java
@@ -52,6 +52,8 @@
  *         necessary to satisfy a binding.</li>
  * </ul>
  *
+ * @param <T> the bound type. The injected is always assignable to this type.
+ *
  * @author crazybob@google.com (Bob Lee)
  * @author jessewilson@google.com (Jesse Wilson)
  */
@@ -63,17 +65,6 @@
   Key<T> getKey();
 
   /**
-   * Returns an arbitrary object containing information about the "place"
-   * where this binding was configured. Used by Guice in the production of
-   * descriptive error messages.
-   *
-   * <p>Tools might specially handle types they know about;
-   * {@code StackTraceElement} is a good example. Tools should simply call
-   * {@code toString()} on the source object if the type is unfamiliar.
-   */
-  Object getSource();
-
-  /**
    * Returns the scoped provider guice uses to fulfill requests for this
    * binding.
    *
@@ -99,6 +90,9 @@
 
   /**
    * 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> {
 
@@ -175,6 +169,9 @@
 
   /**
    * 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> {
 
diff --git a/src/com/google/inject/BindElementProcessor.java b/src/com/google/inject/BindingProcessor.java
similarity index 98%
rename from src/com/google/inject/BindElementProcessor.java
rename to src/com/google/inject/BindingProcessor.java
index a1764a9..6ae857c 100644
--- a/src/com/google/inject/BindElementProcessor.java
+++ b/src/com/google/inject/BindingProcessor.java
@@ -37,7 +37,7 @@
  * @author crazybob@google.com (Bob Lee)
  * @author jessewilson@google.com (Jesse Wilson)
  */
-class BindElementProcessor extends ElementProcessor {
+class BindingProcessor extends AbstractProcessor {
 
   private static final com.google.inject.Binding.ScopingVisitor<LoadStrategy> LOAD_STRATEGY_VISITOR
       = new com.google.inject.Binding.ScopingVisitor<LoadStrategy>() {
@@ -65,7 +65,7 @@
   private final CreationTimeMemberInjector memberInjector;
   private final List<Runnable> untargettedBindings = Lists.newArrayList();
 
-  BindElementProcessor(Errors errors,
+  BindingProcessor(Errors errors,
       InjectorImpl injector,
       Map<Class<? extends Annotation>, Scope> scopes,
       Map<Key<?>, BindingImpl<?>> bindings,
diff --git a/src/com/google/inject/BoundProviderFactory.java b/src/com/google/inject/BoundProviderFactory.java
index 4854062..deda120 100644
--- a/src/com/google/inject/BoundProviderFactory.java
+++ b/src/com/google/inject/BoundProviderFactory.java
@@ -16,7 +16,7 @@
 
 package com.google.inject;
 
-import com.google.inject.BindElementProcessor.CreationListener;
+import com.google.inject.BindingProcessor.CreationListener;
 import com.google.inject.internal.Errors;
 import com.google.inject.internal.ErrorsException;
 import com.google.inject.spi.InjectionPoint;
diff --git a/src/com/google/inject/FactoryProxy.java b/src/com/google/inject/FactoryProxy.java
index 684ad2b..bb8815b 100644
--- a/src/com/google/inject/FactoryProxy.java
+++ b/src/com/google/inject/FactoryProxy.java
@@ -26,7 +26,7 @@
  * A placeholder which enables us to swap in the real factory once the
  * container is created.
  */
-class FactoryProxy<T> implements InternalFactory<T>, BindElementProcessor.CreationListener {
+class FactoryProxy<T> implements InternalFactory<T>, BindingProcessor.CreationListener {
 
   private final Key<T> key;
   private final Key<? extends T> targetKey;
diff --git a/src/com/google/inject/RequestInjectionElementProcessor.java b/src/com/google/inject/InjectionRequestProcessor.java
similarity index 88%
rename from src/com/google/inject/RequestInjectionElementProcessor.java
rename to src/com/google/inject/InjectionRequestProcessor.java
index 222b549..62a67a1 100644
--- a/src/com/google/inject/RequestInjectionElementProcessor.java
+++ b/src/com/google/inject/InjectionRequestProcessor.java
@@ -20,8 +20,8 @@
 import com.google.inject.InjectorImpl.SingleMemberInjector;
 import com.google.inject.internal.Errors;
 import com.google.inject.internal.ErrorsException;
-import com.google.inject.spi.RequestInjection;
-import com.google.inject.spi.RequestStaticInjection;
+import com.google.inject.spi.InjectionRequest;
+import com.google.inject.spi.StaticInjectionRequest;
 import java.util.List;
 
 /**
@@ -31,25 +31,25 @@
  * @author jessewilson@google.com (Jesse Wilson)
  * @author mikeward@google.com (Mike Ward)
  */
-class RequestInjectionElementProcessor extends ElementProcessor {
+class InjectionRequestProcessor extends AbstractProcessor {
 
   private final List<StaticInjection> staticInjections = Lists.newArrayList();
   private final CreationTimeMemberInjector memberInjector;
 
-  RequestInjectionElementProcessor(Errors errors,
+  InjectionRequestProcessor(Errors errors,
       CreationTimeMemberInjector memberInjector) {
     super(errors);
     this.memberInjector = memberInjector;
   }
 
-  @Override public Boolean visitRequestStaticInjection(RequestStaticInjection command) {
+  @Override public Boolean visitStaticInjectionRequest(StaticInjectionRequest command) {
     for (Class<?> type : command.getTypes()) {
       staticInjections.add(new StaticInjection(command.getSource(), type));
     }
     return true;
   }
 
-  @Override public Boolean visitRequestInjection(RequestInjection command) {
+  @Override public Boolean visitInjectionRequest(InjectionRequest command) {
     for (Object instance : command.getInstances()) {
       memberInjector.requestInjection(instance, command.getSource());
     }
diff --git a/src/com/google/inject/InjectorBuilder.java b/src/com/google/inject/InjectorBuilder.java
index 63b045f..5c1086d 100644
--- a/src/com/google/inject/InjectorBuilder.java
+++ b/src/com/google/inject/InjectorBuilder.java
@@ -52,8 +52,8 @@
 
   private final List<Element> elements = Lists.newArrayList();
 
-  private BindElementProcessor bindCommandProcesor;
-  private RequestInjectionElementProcessor requestInjectionCommandProcessor;
+  private BindingProcessor bindCommandProcesor;
+  private InjectionRequestProcessor injectionCommandProcessor;
 
   /**
    * @param stage we're running in. If the stage is {@link Stage#PRODUCTION}, we will eagerly load
@@ -116,24 +116,24 @@
 
   /** Builds the injector. */
   private void buildCoreInjector() {
-    new ErrorsElementProcessor(errors)
+    new MessageProcessor(errors)
         .processCommands(elements);
 
-    BindInterceptorElementProcessor bindInterceptorCommandProcessor
-        = new BindInterceptorElementProcessor(errors);
-    bindInterceptorCommandProcessor.processCommands(elements);
-    ConstructionProxyFactory proxyFactory = bindInterceptorCommandProcessor.createProxyFactory();
+    InterceptorBindingProcessor interceptorCommandProcessor
+        = new InterceptorBindingProcessor(errors);
+    interceptorCommandProcessor.processCommands(elements);
+    ConstructionProxyFactory proxyFactory = interceptorCommandProcessor.createProxyFactory();
     injector.reflection = reflectionFactory.create(proxyFactory);
     stopwatch.resetAndLog("Interceptors creation");
 
-    new ScopesElementProcessor(errors, injector.scopes).processCommands(elements);
+    new ScopeBindingProcessor(errors, injector.scopes).processCommands(elements);
     stopwatch.resetAndLog("Scopes creation");
 
-    new ConvertToTypesElementProcessor(errors, injector.converters).processCommands(elements);
+    new TypeConverterBindingProcessor(errors, injector.converters).processCommands(elements);
     stopwatch.resetAndLog("Converters creation");
 
     bindLogger();
-    bindCommandProcesor = new BindElementProcessor(errors,
+    bindCommandProcesor = new BindingProcessor(errors,
         injector, injector.scopes, injector.explicitBindings,
         injector.memberInjector);
     bindCommandProcesor.processCommands(elements);
@@ -143,9 +143,9 @@
     injector.index();
     stopwatch.resetAndLog("Binding indexing");
 
-    requestInjectionCommandProcessor
-        = new RequestInjectionElementProcessor(errors, injector.memberInjector);
-    requestInjectionCommandProcessor.processCommands(elements);
+    injectionCommandProcessor
+        = new InjectionRequestProcessor(errors, injector.memberInjector);
+    injectionCommandProcessor.processCommands(elements);
     stopwatch.resetAndLog("Static injection");
   }
 
@@ -154,13 +154,13 @@
     bindCommandProcesor.runCreationListeners(injector);
     stopwatch.resetAndLog("Validation");
 
-    requestInjectionCommandProcessor.validate(injector);
+    injectionCommandProcessor.validate(injector);
     stopwatch.resetAndLog("Static validation");
 
     injector.memberInjector.validateOustandingInjections(errors);
     stopwatch.resetAndLog("Instance member validation");
 
-    new GetProviderProcessor(errors, injector).processCommands(elements);
+    new ProviderLookupProcessor(errors, injector).processCommands(elements);
     stopwatch.resetAndLog("Provider verification");
 
     errors.throwCreationExceptionIfErrorsExist();
@@ -168,7 +168,7 @@
 
   /** Inject everything that can be injected. */
   private void fulfillInjectionRequests() {
-    requestInjectionCommandProcessor.injectMembers(injector);
+    injectionCommandProcessor.injectMembers(injector);
     stopwatch.resetAndLog("Static member injection");
 
     injector.memberInjector.injectAll(errors);
diff --git a/src/com/google/inject/BindInterceptorElementProcessor.java b/src/com/google/inject/InterceptorBindingProcessor.java
similarity index 83%
rename from src/com/google/inject/BindInterceptorElementProcessor.java
rename to src/com/google/inject/InterceptorBindingProcessor.java
index c6004bd..e48f67b 100644
--- a/src/com/google/inject/BindInterceptorElementProcessor.java
+++ b/src/com/google/inject/InterceptorBindingProcessor.java
@@ -17,7 +17,7 @@
 package com.google.inject;
 
 import com.google.inject.internal.Errors;
-import com.google.inject.spi.BindInterceptor;
+import com.google.inject.spi.InterceptorBinding;
 
 /**
  * Handles {@link Binder#bindInterceptor} commands.
@@ -25,16 +25,16 @@
  * @author crazybob@google.com (Bob Lee)
  * @author jessewilson@google.com (Jesse Wilson)
  */
-class BindInterceptorElementProcessor extends ElementProcessor {
+class InterceptorBindingProcessor extends AbstractProcessor {
 
   private final ProxyFactoryBuilder proxyFactoryBuilder;
 
-  BindInterceptorElementProcessor(Errors errors) {
+  InterceptorBindingProcessor(Errors errors) {
     super(errors);
     proxyFactoryBuilder = new ProxyFactoryBuilder();
   }
 
-  @Override public Boolean visitBindInterceptor(BindInterceptor command) {
+  @Override public Boolean visitInterceptorBinding(InterceptorBinding command) {
     proxyFactoryBuilder.intercept(
         command.getClassMatcher(), command.getMethodMatcher(), command.getInterceptors());
     return true;
diff --git a/src/com/google/inject/ErrorsElementProcessor.java b/src/com/google/inject/MessageProcessor.java
similarity index 93%
rename from src/com/google/inject/ErrorsElementProcessor.java
rename to src/com/google/inject/MessageProcessor.java
index c1603d8..1cf79eb 100644
--- a/src/com/google/inject/ErrorsElementProcessor.java
+++ b/src/com/google/inject/MessageProcessor.java
@@ -27,11 +27,11 @@
  * @author crazybob@google.com (Bob Lee)
  * @author jessewilson@google.com (Jesse Wilson)
  */
-class ErrorsElementProcessor extends ElementProcessor {
+class MessageProcessor extends AbstractProcessor {
 
   private static final Logger logger = Logger.getLogger(Guice.class.getName());
 
-  ErrorsElementProcessor(Errors errors) {
+  MessageProcessor(Errors errors) {
     super(errors);
   }
 
diff --git a/src/com/google/inject/ProviderLookupProcessor.java b/src/com/google/inject/ProviderLookupProcessor.java
new file mode 100644
index 0000000..f50d3ed
--- /dev/null
+++ b/src/com/google/inject/ProviderLookupProcessor.java
@@ -0,0 +1,49 @@
+/**
+ * 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;
+
+import com.google.inject.internal.Errors;
+import com.google.inject.internal.ErrorsException;
+import com.google.inject.spi.ProviderLookup;
+
+/**
+ * Handles {@link Binder#getProvider} commands.
+ *
+ * @author crazybob@google.com (Bob Lee)
+ * @author jessewilson@google.com (Jesse Wilson)
+ */
+class ProviderLookupProcessor extends AbstractProcessor {
+
+  private final InjectorImpl injector;
+
+  ProviderLookupProcessor(Errors errors, InjectorImpl injector) {
+    super(errors);
+    this.injector = injector;
+  }
+
+  @Override public <T> Boolean visitProviderLookup(ProviderLookup<T> command) {
+    // ensure the provider can be created
+    try {
+      Provider<T> provider = injector.getProviderOrThrow(command.getKey(), errors);
+      command.initDelegate(provider);
+    } catch (ErrorsException e) {
+      errors.merge(e.getErrors()); // TODO: source
+    }
+
+    return true;
+  }
+}
diff --git a/src/com/google/inject/ScopesElementProcessor.java b/src/com/google/inject/ScopeBindingProcessor.java
similarity index 90%
rename from src/com/google/inject/ScopesElementProcessor.java
rename to src/com/google/inject/ScopeBindingProcessor.java
index 8990f35..c2f10c4 100644
--- a/src/com/google/inject/ScopesElementProcessor.java
+++ b/src/com/google/inject/ScopeBindingProcessor.java
@@ -20,7 +20,7 @@
 import com.google.inject.internal.Annotations;
 import com.google.inject.internal.Errors;
 import com.google.inject.internal.StackTraceElements;
-import com.google.inject.spi.BindScope;
+import com.google.inject.spi.ScopeBinding;
 import java.lang.annotation.Annotation;
 import java.util.Map;
 
@@ -30,17 +30,17 @@
  * @author crazybob@google.com (Bob Lee)
  * @author jessewilson@google.com (Jesse Wilson)
  */
-class ScopesElementProcessor extends ElementProcessor {
+class ScopeBindingProcessor extends AbstractProcessor {
 
   private final Map<Class<? extends Annotation>, Scope> scopes;
 
-  ScopesElementProcessor(Errors errors,
+  ScopeBindingProcessor(Errors errors,
       Map<Class<? extends Annotation>, Scope> scopes) {
     super(errors);
     this.scopes = scopes;
   }
 
-  @Override public Boolean visitBindScope(BindScope command) {
+  @Override public Boolean visitScopeBinding(ScopeBinding command) {
     Scope scope = command.getScope();
     Class<? extends Annotation> annotationType = command.getAnnotationType();
 
diff --git a/src/com/google/inject/ConvertToTypesElementProcessor.java b/src/com/google/inject/TypeConverterBindingProcessor.java
similarity index 94%
rename from src/com/google/inject/ConvertToTypesElementProcessor.java
rename to src/com/google/inject/TypeConverterBindingProcessor.java
index 05e41f6..1f2b291 100644
--- a/src/com/google/inject/ConvertToTypesElementProcessor.java
+++ b/src/com/google/inject/TypeConverterBindingProcessor.java
@@ -24,8 +24,8 @@
 import com.google.inject.matcher.AbstractMatcher;
 import com.google.inject.matcher.Matcher;
 import com.google.inject.matcher.Matchers;
-import com.google.inject.spi.ConvertToTypes;
 import com.google.inject.spi.TypeConverter;
+import com.google.inject.spi.TypeConverterBinding;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.lang.reflect.Type;
@@ -37,11 +37,11 @@
  * @author crazybob@google.com (Bob Lee)
  * @author jessewilson@google.com (Jesse Wilson)
  */
-class ConvertToTypesElementProcessor extends ElementProcessor {
+class TypeConverterBindingProcessor extends AbstractProcessor {
 
   private final List<MatcherAndConverter> converters;
 
-  ConvertToTypesElementProcessor(Errors errors, List<MatcherAndConverter> converters) {
+  TypeConverterBindingProcessor(Errors errors, List<MatcherAndConverter> converters) {
     super(errors);
     this.converters = converters;
 
@@ -165,7 +165,7 @@
     converters.add(new MatcherAndConverter(typeMatcher, converter, SourceProvider.UNKNOWN_SOURCE));
   }
 
-  @Override public Boolean visitConvertToTypes(ConvertToTypes command) {
+  @Override public Boolean visitTypeConverterBinding(TypeConverterBinding command) {
     converters.add(new MatcherAndConverter(
         command.getTypeMatcher(), command.getTypeConverter(), command.getSource()));
     return true;
diff --git a/src/com/google/inject/commands/BindInterceptorCommand.java b/src/com/google/inject/commands/BindInterceptorCommand.java
index 156e449..fdfc550 100644
--- a/src/com/google/inject/commands/BindInterceptorCommand.java
+++ b/src/com/google/inject/commands/BindInterceptorCommand.java
@@ -27,7 +27,7 @@
 /**
  * Immutable snapshot of a request to bind an interceptor.
  *
- * @deprecated replaced with {@link com.google.inject.spi.BindInterceptor}
+ * @deprecated replaced with {@link com.google.inject.spi.InterceptorBinding}
  *
  * @author jessewilson@google.com (Jesse Wilson)
  */
diff --git a/src/com/google/inject/commands/BindScopeCommand.java b/src/com/google/inject/commands/BindScopeCommand.java
index de809da..2c17e81 100644
--- a/src/com/google/inject/commands/BindScopeCommand.java
+++ b/src/com/google/inject/commands/BindScopeCommand.java
@@ -23,7 +23,7 @@
 /**
  * Immutable snapshot of a request to bind a scope.
  *
- * @deprecated replaced with {@link com.google.inject.spi.BindScope}
+ * @deprecated replaced with {@link com.google.inject.spi.ScopeBinding}
  *
  * @author jessewilson@google.com (Jesse Wilson)
  */
diff --git a/src/com/google/inject/commands/ConvertToTypesCommand.java b/src/com/google/inject/commands/ConvertToTypesCommand.java
index c059bdd..c1276a1 100644
--- a/src/com/google/inject/commands/ConvertToTypesCommand.java
+++ b/src/com/google/inject/commands/ConvertToTypesCommand.java
@@ -24,7 +24,7 @@
 /**
  * Immutable snapshot of a request to convert binder types.
  *
- * @deprecated replaced with {@link com.google.inject.spi.ConvertToTypes}
+ * @deprecated replaced with {@link com.google.inject.spi.TypeConverterBinding}
  *
  * @author jessewilson@google.com (Jesse Wilson)
  */
diff --git a/src/com/google/inject/commands/GetProviderCommand.java b/src/com/google/inject/commands/GetProviderCommand.java
index 10fe03e..7854eed 100644
--- a/src/com/google/inject/commands/GetProviderCommand.java
+++ b/src/com/google/inject/commands/GetProviderCommand.java
@@ -24,7 +24,7 @@
 /**
  * Immutable snapshot of a request for a provider.
  *
- * @deprecated replaced with {@link com.google.inject.spi.GetProvider}
+ * @deprecated replaced with {@link com.google.inject.spi.ProviderLookup}
  *
  * @author jessewilson@google.com (Jesse Wilson)
  */
diff --git a/src/com/google/inject/commands/RequestInjectionCommand.java b/src/com/google/inject/commands/RequestInjectionCommand.java
index 351f0cf..60ab2f6 100644
--- a/src/com/google/inject/commands/RequestInjectionCommand.java
+++ b/src/com/google/inject/commands/RequestInjectionCommand.java
@@ -23,7 +23,7 @@
 /**
  * Immutable snapshot of a request for injection.
  *
- * @deprecated replaced with {@link com.google.inject.spi.RequestInjection}
+ * @deprecated replaced with {@link com.google.inject.spi.InjectionRequest}
  *
  * @author mikeward@google.com (Mike Ward)
  */
diff --git a/src/com/google/inject/commands/RequestStaticInjectionCommand.java b/src/com/google/inject/commands/RequestStaticInjectionCommand.java
index e91c42e..0fd15a6 100644
--- a/src/com/google/inject/commands/RequestStaticInjectionCommand.java
+++ b/src/com/google/inject/commands/RequestStaticInjectionCommand.java
@@ -24,7 +24,7 @@
 /**
  * Immutable snapshot of a request for static injection.
  * 
- * @deprecated replaced with {@link com.google.inject.spi.RequestStaticInjection}
+ * @deprecated replaced with {@link com.google.inject.spi.StaticInjectionRequest}
  *
  * @author jessewilson@google.com (Jesse Wilson)
  */
diff --git a/src/com/google/inject/spi/DefaultElementVisitor.java b/src/com/google/inject/spi/DefaultElementVisitor.java
index 09e620a..e276663 100644
--- a/src/com/google/inject/spi/DefaultElementVisitor.java
+++ b/src/com/google/inject/spi/DefaultElementVisitor.java
@@ -23,9 +23,12 @@
  * No-op visitor for subclassing. All interface methods simply delegate to
  * {@link #visitElement(Element)}, returning its result.
  *
+ * @param <V> any type to be returned by the visit method. Use {@link Void} with
+ *     {@code return null} if no return type is needed.
+ *
  * @author sberlin@gmail.com (Sam Berlin)
  */
-public class DefaultElementVisitor<V> implements Element.Visitor<V> {
+public abstract class DefaultElementVisitor<V> implements Element.Visitor<V> {
 
   protected DefaultElementVisitor() {}
 
@@ -44,27 +47,27 @@
     return visitElement(command);
   }
 
-  public V visitBindInterceptor(BindInterceptor command) {
+  public V visitInterceptorBinding(InterceptorBinding command) {
     return visitElement(command);
   }
 
-  public V visitBindScope(BindScope command) {
+  public V visitScopeBinding(ScopeBinding command) {
     return visitElement(command);
   }
 
-  public V visitConvertToTypes(ConvertToTypes command) {
+  public V visitTypeConverterBinding(TypeConverterBinding command) {
     return visitElement(command);
   }
 
-  public <T> V visitGetProvider(GetProvider<T> command) {
+  public <T> V visitProviderLookup(ProviderLookup<T> command) {
     return visitElement(command);
   }
 
-  public V visitRequestInjection(RequestInjection command) {
+  public V visitInjectionRequest(InjectionRequest command) {
     return visitElement(command);
   }
 
-  public V visitRequestStaticInjection(RequestStaticInjection command) {
+  public V visitStaticInjectionRequest(StaticInjectionRequest command) {
     return visitElement(command);
   }
 }
diff --git a/src/com/google/inject/spi/Element.java b/src/com/google/inject/spi/Element.java
index 14a0b03..182161b 100644
--- a/src/com/google/inject/spi/Element.java
+++ b/src/com/google/inject/spi/Element.java
@@ -19,11 +19,28 @@
 import com.google.inject.Binding;
 
 /**
- * Immutable snapshot of a binding command.
+ * 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.
+ *
+ * <p>The elements of an injector can be inspected and exercised. Use {@link
+ * com.google.inject.Injector#getBindings} to reflect on Guice injectors.
  *
  * @author jessewilson@google.com (Jesse Wilson)
  */
 public interface Element {
+
+  /**
+   * Returns an arbitrary object containing information about the "place" where this element was
+   * configured. Used by Guice in the production of descriptive error messages.
+   *
+   * <p>Tools might specially handle types they know about; {@code StackTraceElement} is a good
+   * example. Tools should simply call {@code toString()} on the source object if the type is
+   * unfamiliar.
+   */
   Object getSource();
 
   /**
@@ -34,16 +51,52 @@
   <T> T acceptVisitor(Visitor<T> visitor);
 
   /**
-   * Visit commands.
+   * Visit elements.
+   *
+   * @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 Visitor<V> {
-    V visitMessage(Message message);
-    V visitBindInterceptor(BindInterceptor bindInterceptor);
-    V visitBindScope(BindScope bindScope);
-    V visitRequestInjection(RequestInjection requestInjection);
-    V visitRequestStaticInjection(RequestStaticInjection requestStaticInjection);
-    V visitConvertToTypes(ConvertToTypes convertToTypes);
+
+    /**
+     * Visit a mapping from a key (type and optional annotation) to the strategy for getting
+     * instances of the type.
+     */
     <T> V visitBinding(Binding<T> binding);
-    <T> V visitGetProvider(GetProvider<T> getProvider);
+
+    /**
+     * Visit a registration of interceptors for matching methods of matching classes.
+     */
+    V visitInterceptorBinding(InterceptorBinding interceptorBinding);
+
+    /**
+     * Visit a registration of a scope annotation with the scope that implements it.
+     */
+    V visitScopeBinding(ScopeBinding scopeBinding);
+
+    /**
+     * Visit a registration of type converters for matching target types.
+     */
+    V visitTypeConverterBinding(TypeConverterBinding typeConverterBinding);
+
+    /**
+     * Visit a request to inject the instance fields and methods of an instance.
+     */
+    V visitInjectionRequest(InjectionRequest injectionRequest);
+
+    /**
+     * Visit a request to inject the static fields and methods of type.
+     */
+    V visitStaticInjectionRequest(StaticInjectionRequest staticInjectionRequest);
+
+    /**
+     * Visit a lookup of the provider for a type.
+     */
+    <T> V visitProviderLookup(ProviderLookup<T> providerLookup);
+
+    /**
+     * Visit an error message and the context in which it occured.
+     */
+    V visitMessage(Message message);
   }
 }
diff --git a/src/com/google/inject/spi/Elements.java b/src/com/google/inject/spi/Elements.java
index 68fa368..09be0d5 100644
--- a/src/com/google/inject/spi/Elements.java
+++ b/src/com/google/inject/spi/Elements.java
@@ -43,8 +43,8 @@
 import org.aopalliance.intercept.MethodInterceptor;
 
 /**
- * Records elements executed by a module so they can be inspected or
- * {@link ModuleWriter replayed}.
+ * Exposes elements of a module so they can be inspected, validated or {@link ModuleWriter 
+ * rewritten}.
  *
  * @author jessewilson@google.com (Jesse Wilson)
  */
@@ -131,19 +131,19 @@
         Matcher<? super Class<?>> classMatcher,
         Matcher<? super Method> methodMatcher,
         MethodInterceptor... interceptors) {
-      elements.add(new BindInterceptor(getSource(), classMatcher, methodMatcher, interceptors));
+      elements.add(new InterceptorBinding(getSource(), classMatcher, methodMatcher, interceptors));
     }
 
     public void bindScope(Class<? extends Annotation> annotationType, Scope scope) {
-      elements.add(new BindScope(getSource(), annotationType, scope));
+      elements.add(new ScopeBinding(getSource(), annotationType, scope));
     }
 
     public void requestInjection(Object... instances) {
-      elements.add(new RequestInjection(getSource(), instances));
+      elements.add(new InjectionRequest(getSource(), instances));
     }
 
     public void requestStaticInjection(Class<?>... types) {
-      elements.add(new RequestStaticInjection(getSource(), types));
+      elements.add(new StaticInjectionRequest(getSource(), types));
     }
 
     public void install(Module module) {
@@ -193,7 +193,7 @@
     }
 
     public <T> Provider<T> getProvider(final Key<T> key) {
-      final GetProvider<T> command = new GetProvider<T>(getSource(), key);
+      final ProviderLookup<T> command = new ProviderLookup<T>(getSource(), key);
       elements.add(command);
       return new Provider<T>() {
         public T get() {
@@ -215,7 +215,7 @@
 
     public void convertToTypes(Matcher<? super TypeLiteral<?>> typeMatcher,
         TypeConverter converter) {
-      elements.add(new ConvertToTypes(getSource(), typeMatcher, converter));
+      elements.add(new TypeConverterBinding(getSource(), typeMatcher, converter));
     }
 
     public Binder withSource(final Object source) {
diff --git a/src/com/google/inject/spi/RequestInjection.java b/src/com/google/inject/spi/InjectionRequest.java
similarity index 72%
rename from src/com/google/inject/spi/RequestInjection.java
rename to src/com/google/inject/spi/InjectionRequest.java
index 3eb9866..e961c90 100644
--- a/src/com/google/inject/spi/RequestInjection.java
+++ b/src/com/google/inject/spi/InjectionRequest.java
@@ -21,15 +21,19 @@
 import java.util.List;
 
 /**
- * Immutable snapshot of a request for injection.
+ * A request to inject the instance fields and methods of an instance. Requests are created
+ * explicitly in a module using {@link com.google.inject.Binder#requestInjection(Object[])
+ * requestInjection()} statements:
+ * <pre>
+ *     requestInjection(serviceInstance);</pre>
  *
  * @author mikeward@google.com (Mike Ward)
  */
-public final class RequestInjection implements Element {
+public final class InjectionRequest implements Element {
   private Object source;
   private List<Object> instances;
 
-  public RequestInjection(Object source, Object[] instances) {
+  public InjectionRequest(Object source, Object[] instances) {
     this.source = checkNotNull(source, "source");
     this.instances = ImmutableList.of(instances);
   }
@@ -43,6 +47,6 @@
   }
 
   public <T> T acceptVisitor(Visitor<T> visitor) {
-    return visitor.visitRequestInjection(this);
+    return visitor.visitInjectionRequest(this);
   }
 }
diff --git a/src/com/google/inject/spi/BindInterceptor.java b/src/com/google/inject/spi/InterceptorBinding.java
similarity index 77%
rename from src/com/google/inject/spi/BindInterceptor.java
rename to src/com/google/inject/spi/InterceptorBinding.java
index 8fa916c..179681a 100644
--- a/src/com/google/inject/spi/BindInterceptor.java
+++ b/src/com/google/inject/spi/InterceptorBinding.java
@@ -25,17 +25,23 @@
 import org.aopalliance.intercept.MethodInterceptor;
 
 /**
- * Immutable snapshot of a request to bind an interceptor.
+ * Registration of interceptors for matching methods of matching classes. Instances are created
+ * explicitly in a module using {@link com.google.inject.Binder#bindInterceptor(
+ * Matcher, Matcher, MethodInterceptor[]) bindInterceptor()} statements:
+ * <pre>
+ *     bindInterceptor(Matchers.subclassesOf(MyAction.class),
+ *         Matchers.annotatedWith(Transactional.class),
+ *         new MyTransactionInterceptor());</pre>
  *
  * @author jessewilson@google.com (Jesse Wilson)
  */
-public final class BindInterceptor implements Element {
+public final class InterceptorBinding implements Element {
   private final Object source;
   private final Matcher<? super Class<?>> classMatcher;
   private final Matcher<? super Method> methodMatcher;
   private final List<MethodInterceptor> interceptors;
 
-  BindInterceptor(
+  InterceptorBinding(
       Object source,
       Matcher<? super Class<?>> classMatcher,
       Matcher<? super Method> methodMatcher,
@@ -63,6 +69,6 @@
   }
 
   public <T> T acceptVisitor(Visitor<T> visitor) {
-    return visitor.visitBindInterceptor(this);
+    return visitor.visitInterceptorBinding(this);
   }
 }
diff --git a/src/com/google/inject/spi/Message.java b/src/com/google/inject/spi/Message.java
index 39dce1d..19f8a7e 100644
--- a/src/com/google/inject/spi/Message.java
+++ b/src/com/google/inject/spi/Message.java
@@ -24,8 +24,15 @@
 import java.util.List;
 
 /**
- * A message. Contains a source pointing to the code which resulted
- * in this message and a text message.
+ * An error message and the context in which it occured. Messages are usually created internally by
+ * Guice and its extensions. Messages can be created explicitly in a module using {@link
+ * com.google.inject.Binder#addError(Throwable) addError()} statements:
+ * <pre>
+ *     try {
+ *       bindPropertiesFromFile();
+ *     } catch (IOException e) {
+ *       addError(e);
+ *     }</pre>
  *
  * @author crazybob@google.com (Bob Lee)
  */
@@ -56,9 +63,6 @@
     this(SourceProvider.UNKNOWN_SOURCE, message, ImmutableList.<InjectionPoint>of(), null);
   }
 
-  /**
-   * Returns a string representation of the source object. 
-   */
   public String getSource() {
     return source;
   }
diff --git a/src/com/google/inject/spi/ModuleWriter.java b/src/com/google/inject/spi/ModuleWriter.java
index c4c1372..61e76bf 100644
--- a/src/com/google/inject/spi/ModuleWriter.java
+++ b/src/com/google/inject/spi/ModuleWriter.java
@@ -31,7 +31,7 @@
 import org.aopalliance.intercept.MethodInterceptor;
 
 /**
- * Converts elements into a Module.
+ * Creates a Module from a collection of component elements.
  *
  * @author jessewilson@google.com (Jesse Wilson)
  */
@@ -63,38 +63,38 @@
         return null;
       }
 
-      public Void visitBindInterceptor(BindInterceptor command) {
-        writeBindInterceptor(binder, command);
+      public Void visitInterceptorBinding(InterceptorBinding element) {
+        writeBindInterceptor(binder, element);
         return null;
       }
 
-      public Void visitBindScope(BindScope command) {
-        writeBindScope(binder, command);
+      public Void visitScopeBinding(ScopeBinding element) {
+        writeBindScope(binder, element);
         return null;
       }
 
-      public Void visitRequestInjection(RequestInjection command) {
-        writeRequestInjection(binder, command);
+      public Void visitInjectionRequest(InjectionRequest element) {
+        writeRequestInjection(binder, element);
         return null;
       }
 
-      public Void visitRequestStaticInjection(RequestStaticInjection command) {
-        writeRequestStaticInjection(binder, command);
+      public Void visitStaticInjectionRequest(StaticInjectionRequest element) {
+        writeRequestStaticInjection(binder, element);
         return null;
       }
 
-      public Void visitConvertToTypes(ConvertToTypes command) {
-        writeConvertToTypes(binder, command);
+      public Void visitTypeConverterBinding(TypeConverterBinding element) {
+        writeConvertToTypes(binder, element);
         return null;
       }
 
-      public <T> Void visitBinding(Binding<T> command) {
-        writeBind(binder, command);
+      public <T> Void visitBinding(Binding<T> element) {
+        writeBind(binder, element);
         return null;
       }
 
-      public <T> Void visitGetProvider(GetProvider<T> command) {
-        writeGetProvider(binder, command);
+      public <T> Void visitProviderLookup(ProviderLookup<T> element) {
+        writeGetProvider(binder, element);
         return null;
       }
     };
@@ -104,46 +104,46 @@
     }
   }
 
-  public void writeMessage(final Binder binder, final Message message) {
-    binder.addError(message);
+  public void writeMessage(final Binder binder, final Message element) {
+    binder.addError(element);
   }
 
-  public void writeBindInterceptor(final Binder binder, final BindInterceptor command) {
-    List<MethodInterceptor> interceptors = command.getInterceptors();
-    binder.withSource(command.getSource()).bindInterceptor(
-        command.getClassMatcher(), command.getMethodMatcher(),
+  public void writeBindInterceptor(final Binder binder, final InterceptorBinding element) {
+    List<MethodInterceptor> interceptors = element.getInterceptors();
+    binder.withSource(element.getSource()).bindInterceptor(
+        element.getClassMatcher(), element.getMethodMatcher(),
         interceptors.toArray(new MethodInterceptor[interceptors.size()]));
   }
 
-  public void writeBindScope(final Binder binder, final BindScope command) {
-    binder.withSource(command.getSource()).bindScope(
-        command.getAnnotationType(), command.getScope());
+  public void writeBindScope(final Binder binder, final ScopeBinding element) {
+    binder.withSource(element.getSource()).bindScope(
+        element.getAnnotationType(), element.getScope());
   }
 
   public void writeRequestInjection(final Binder binder,
-      final RequestInjection command) {
+      final InjectionRequest command) {
     List<Object> objects = command.getInstances();
     binder.withSource(command.getSource())
         .requestInjection(objects.toArray());
   }
 
   public void writeRequestStaticInjection(final Binder binder,
-      final RequestStaticInjection command) {
-    List<Class> types = command.getTypes();
-    binder.withSource(command.getSource())
+      final StaticInjectionRequest element) {
+    List<Class> types = element.getTypes();
+    binder.withSource(element.getSource())
         .requestStaticInjection(types.toArray(new Class[types.size()]));
   }
 
-  public void writeConvertToTypes(final Binder binder, final ConvertToTypes command) {
-    binder.withSource(command.getSource())
-        .convertToTypes(command.getTypeMatcher(), command.getTypeConverter());
+  public void writeConvertToTypes(final Binder binder, final TypeConverterBinding element) {
+    binder.withSource(element.getSource())
+        .convertToTypes(element.getTypeMatcher(), element.getTypeConverter());
   }
 
-  public <T> void writeBind(final Binder binder, final Binding<T> binding) {
-    LinkedBindingBuilder<T> lbb = binder.withSource(binding.getSource()).bind(binding.getKey());
+  public <T> void writeBind(final Binder binder, final Binding<T> element) {
+    LinkedBindingBuilder<T> lbb = binder.withSource(element.getSource()).bind(element.getKey());
 
-    ScopedBindingBuilder sbb = applyTarget(binding, lbb);
-    applyScoping(binding, sbb);
+    ScopedBindingBuilder sbb = applyTarget(element, lbb);
+    applyScoping(element, sbb);
   }
 
   /**
@@ -211,8 +211,8 @@
     });
   }
 
-  public <T> void writeGetProvider(final Binder binder, final GetProvider<T> command) {
-    Provider<T> provider = binder.withSource(command.getSource()).getProvider(command.getKey());
-    command.initDelegate(provider);
+  public <T> void writeGetProvider(final Binder binder, final ProviderLookup<T> element) {
+    Provider<T> provider = binder.withSource(element.getSource()).getProvider(element.getKey());
+    element.initDelegate(provider);
   }
 }
diff --git a/src/com/google/inject/spi/ProviderLookup.java b/src/com/google/inject/spi/ProviderLookup.java
new file mode 100644
index 0000000..a417995
--- /dev/null
+++ b/src/com/google/inject/spi/ProviderLookup.java
@@ -0,0 +1,68 @@
+/**
+ * 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 static com.google.common.base.Preconditions.checkNotNull;
+import static com.google.common.base.Preconditions.checkState;
+import com.google.inject.Key;
+import com.google.inject.Provider;
+
+/**
+ * A lookup of the provider for a type. Lookups are created explicitly in a module using
+ * {@link com.google.inject.Binder#getProvider(Class) getProvider()} statements:
+ * <pre>
+ *     Provider&lt;PaymentService&gt; paymentServiceProvider
+ *         = getProvider(PaymentService.class);</pre>
+ *
+ * @author jessewilson@google.com (Jesse Wilson)
+ */
+public final class ProviderLookup<T> implements Element {
+  private final Object source;
+  private final Key<T> key;
+  private Provider<T> delegate;
+
+  ProviderLookup(Object source, Key<T> key) {
+    this.source = checkNotNull(source, "source");
+    this.key = checkNotNull(key, "key");
+  }
+
+  public Object getSource() {
+    return source;
+  }
+
+  public Key<T> getKey() {
+    return key;
+  }
+
+  public <T> T acceptVisitor(Visitor<T> visitor) {
+    return visitor.visitProviderLookup(this);
+  }
+
+  public void initDelegate(Provider<T> delegate) {
+    checkState(this.delegate == null, "delegate already initialized");
+    checkNotNull(delegate, "delegate");
+    this.delegate = delegate;
+  }
+
+  /**
+   * Returns the delegate provider, or {@code null} if it has not yet been initialized. The delegate
+   * will be initialized when this element is processed, or otherwise used to create an injector.
+   */
+  public Provider<T> getDelegate() {
+    return delegate;
+  }
+}
diff --git a/src/com/google/inject/spi/BindScope.java b/src/com/google/inject/spi/ScopeBinding.java
similarity index 72%
rename from src/com/google/inject/spi/BindScope.java
rename to src/com/google/inject/spi/ScopeBinding.java
index 4731bcb..36c9208 100644
--- a/src/com/google/inject/spi/BindScope.java
+++ b/src/com/google/inject/spi/ScopeBinding.java
@@ -21,16 +21,21 @@
 import java.lang.annotation.Annotation;
 
 /**
- * Immutable snapshot of a request to bind a scope.
+ * Registration of a scope annotation with the scope that implements it. Instances are created
+ * explicitly in a module using {@link com.google.inject.Binder#bindScope(Class, Scope) bindScope()}
+ * statements:
+ * <pre>
+ *     Scope recordScope = new RecordScope();
+ *     bindScope(RecordScoped.class, new RecordScope());</pre>
  *
  * @author jessewilson@google.com (Jesse Wilson)
  */
-public final class BindScope implements Element {
+public final class ScopeBinding implements Element {
   private final Object source;
   private final Class<? extends Annotation> annotationType;
   private final Scope scope;
 
-  BindScope(Object source, Class<? extends Annotation> annotationType, Scope scope) {
+  ScopeBinding(Object source, Class<? extends Annotation> annotationType, Scope scope) {
     this.source = checkNotNull(source, "source");
     this.annotationType = checkNotNull(annotationType, "annotationType");
     this.scope = checkNotNull(scope, "scope");
@@ -49,6 +54,6 @@
   }
 
   public <T> T acceptVisitor(Visitor<T> visitor) {
-    return visitor.visitBindScope(this);
+    return visitor.visitScopeBinding(this);
   }
 }
diff --git a/src/com/google/inject/spi/RequestStaticInjection.java b/src/com/google/inject/spi/StaticInjectionRequest.java
similarity index 71%
rename from src/com/google/inject/spi/RequestStaticInjection.java
rename to src/com/google/inject/spi/StaticInjectionRequest.java
index 5c9b2fa..0f47e7e 100644
--- a/src/com/google/inject/spi/RequestStaticInjection.java
+++ b/src/com/google/inject/spi/StaticInjectionRequest.java
@@ -22,15 +22,19 @@
 import java.util.List;
 
 /**
- * Immutable snapshot of a request for static injection.
- * 
+ * A request to inject the static fields and methods of type. Requests are created
+ * explicitly in a module using {@link com.google.inject.Binder#requestStaticInjection(Class[])
+ * requestStaticInjection()} statements:
+ * <pre>
+ *     requestStaticInjection(MyLegacyService.class);</pre>
+ *
  * @author jessewilson@google.com (Jesse Wilson)
  */
-public final class RequestStaticInjection implements Element {
+public final class StaticInjectionRequest implements Element {
   private final Object source;
   private final List<Class> types;
 
-  RequestStaticInjection(Object source, Class[] types) {
+  StaticInjectionRequest(Object source, Class[] types) {
     this.source = checkNotNull(source, "source");
     this.types = ImmutableList.of(types);
   }
@@ -44,6 +48,6 @@
   }
 
   public <T> T acceptVisitor(Visitor<T> visitor) {
-    return visitor.visitRequestStaticInjection(this);
+    return visitor.visitStaticInjectionRequest(this);
   }
 }
diff --git a/src/com/google/inject/spi/ConvertToTypes.java b/src/com/google/inject/spi/TypeConverterBinding.java
similarity index 74%
rename from src/com/google/inject/spi/ConvertToTypes.java
rename to src/com/google/inject/spi/TypeConverterBinding.java
index 2443166..58f3623 100644
--- a/src/com/google/inject/spi/ConvertToTypes.java
+++ b/src/com/google/inject/spi/TypeConverterBinding.java
@@ -21,16 +21,20 @@
 import com.google.inject.matcher.Matcher;
 
 /**
- * Immutable snapshot of a request to convert binder types.
+ * Registration of type converters for matching target types. Instances are created
+ * explicitly in a module using {@link com.google.inject.Binder#convertToTypes(Matcher,
+ * TypeConverter) convertToTypes()} statements:
+ * <pre>
+ *     convertToTypes(Matchers.only(DateTime.class), new DateTimeConverter());</pre>
  *
  * @author jessewilson@google.com (Jesse Wilson)
  */
-public final class ConvertToTypes implements Element {
+public final class TypeConverterBinding implements Element {
   private final Object source;
   private final Matcher<? super TypeLiteral<?>> typeMatcher;
   private final TypeConverter typeConverter;
 
-  ConvertToTypes(Object source, Matcher<? super TypeLiteral<?>> typeMatcher,
+  TypeConverterBinding(Object source, Matcher<? super TypeLiteral<?>> typeMatcher,
       TypeConverter typeConverter) {
     this.source = checkNotNull(source, "source");
     this.typeMatcher = checkNotNull(typeMatcher, "typeMatcher");
@@ -50,6 +54,6 @@
   }
 
   public <T> T acceptVisitor(Visitor<T> visitor) {
-    return visitor.visitConvertToTypes(this);
+    return visitor.visitTypeConverterBinding(this);
   }
 }
diff --git a/test/com/google/inject/spi/ElementsTest.java b/test/com/google/inject/spi/ElementsTest.java
index f73c9a5..eaa7db5 100644
--- a/test/com/google/inject/spi/ElementsTest.java
+++ b/test/com/google/inject/spi/ElementsTest.java
@@ -533,7 +533,7 @@
         },
 
         new FailingElementVisitor() {
-          @Override public Void visitBindInterceptor(BindInterceptor command) {
+          @Override public Void visitInterceptorBinding(InterceptorBinding command) {
             assertSame(classMatcher, command.getClassMatcher());
             assertSame(methodMatcher, command.getMethodMatcher());
             assertEquals(Arrays.asList(methodInterceptor), command.getInterceptors());
@@ -552,7 +552,7 @@
         },
 
         new FailingElementVisitor() {
-          @Override public Void visitBindScope(BindScope command) {
+          @Override public Void visitScopeBinding(ScopeBinding command) {
             assertSame(SampleAnnotation.class, command.getAnnotationType());
             assertSame(Scopes.NO_SCOPE, command.getScope());
             return null;
@@ -576,7 +576,7 @@
         },
 
         new FailingElementVisitor() {
-          @Override public Void visitConvertToTypes(ConvertToTypes command) {
+          @Override public Void visitTypeConverterBinding(TypeConverterBinding command) {
             assertSame(typeConverter, command.getTypeConverter());
             assertSame(Matchers.any(), command.getTypeMatcher());
             return null;
@@ -608,7 +608,7 @@
         },
 
         new FailingElementVisitor() {
-          @Override public Void visitGetProvider(GetProvider command) {
+          @Override public Void visitProviderLookup(ProviderLookup command) {
             assertEquals(Key.get(String.class, SampleAnnotation.class), command.getKey());
             assertNull(command.getDelegate());
             return null;
@@ -616,7 +616,7 @@
         },
 
         new FailingElementVisitor() {
-          @Override public Void visitGetProvider(GetProvider command) {
+          @Override public Void visitProviderLookup(ProviderLookup command) {
             assertEquals(Key.get(String.class), command.getKey());
             assertNull(command.getDelegate());
             return null;
@@ -637,7 +637,7 @@
         },
 
         new FailingElementVisitor() {
-          @Override public Void visitRequestInjection(RequestInjection command) {
+          @Override public Void visitInjectionRequest(InjectionRequest command) {
             assertEquals(Arrays.asList(firstObject, secondObject), command.getInstances());
             return null;
           }
@@ -654,7 +654,7 @@
         },
 
         new FailingElementVisitor() {
-          @Override public Void visitRequestStaticInjection(RequestStaticInjection command) {
+          @Override public Void visitStaticInjectionRequest(StaticInjectionRequest command) {
             assertEquals(Arrays.asList(ArrayList.class), command.getTypes());
             return null;
           }