HUGE refactoring of InjectorImpl. getBinding() now returns synthetic bindings in addition to explicit bindings. No more warnings in InjectorImpl!!!

git-svn-id: https://google-guice.googlecode.com/svn/trunk@359 d779f126-a31b-0410-b53b-1d3aecad763e
diff --git a/src/com/google/inject/ClassBindingImpl.java b/src/com/google/inject/ClassBindingImpl.java
new file mode 100644
index 0000000..cdeb3cd
--- /dev/null
+++ b/src/com/google/inject/ClassBindingImpl.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2007 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.spi.ClassBinding;
+import com.google.inject.spi.BindingVisitor;
+import com.google.inject.internal.ToStringBuilder;
+
+/**
+ *
+ *
+ */
+class ClassBindingImpl<T> extends BindingImpl<T>
+    implements ClassBinding<T> {
+
+  ClassBindingImpl(InjectorImpl injector, Key<T> key, Object source,
+      InternalFactory<? extends T> internalFactory, Scope scope) {
+    super(injector, key, source, internalFactory, scope);
+  }
+
+  public void accept(BindingVisitor<? super T> visitor) {
+    visitor.visit(this);
+  }
+
+  @SuppressWarnings("unchecked")
+  public Class<T> getBoundClass() {
+    // T should always be the class itself.
+    return (Class<T>) key.getRawType();
+  }
+
+  @Override
+  public String toString() {
+    return new ToStringBuilder(ClassBinding.class)
+        .add("class", getBoundClass())
+        .add("scope", scope)
+        .add("source", source)
+        .toString();
+  }
+}