Locked down binder API even more.
git-svn-id: https://google-guice.googlecode.com/svn/trunk@255 d779f126-a31b-0410-b53b-1d3aecad763e
diff --git a/guice.ipr b/guice.ipr
index 5866805..a911ed0 100644
--- a/guice.ipr
+++ b/guice.ipr
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<project version="4" relativePaths="true">
+<project version="4" relativePaths="false">
<component name="AntConfiguration">
<defaultAnt bundledAnt="true" />
<buildFile url="file://$PROJECT_DIR$/build.xml">
@@ -15,7 +15,7 @@
<class-settings class="com.google.devtools.intellig.configcheck.ProjectPathChecker" />
<class-settings class="com.google.devtools.intellig.configcheck.PythonSdkChecker" />
<class-settings class="com.google.devtools.intellig.configcheck.ProjectJdkChecker">
- <setting name="getProjectJdk" value="$PROJECT_DIR$/../../buildtools/java/jdk1.5.0_06" />
+ <setting name="getProjectJdk" value="/Users/crazybob/buildtools/java/jdk1.5.0_06" />
<setting name="getModuleJdks" value="rO0ABXNyABFqYXZhLnV0aWwuSGFzaFNldLpEhZWWuLc0AwAAeHB3DAAAABA/QAAAAAAAAHg=" />
</class-settings>
<class-settings class="com.google.devtools.intellig.configcheck.ClearOutputChecker" />
diff --git a/src/com/google/inject/AbstractModule.java b/src/com/google/inject/AbstractModule.java
index 20ba695..5dab1b9 100644
--- a/src/com/google/inject/AbstractModule.java
+++ b/src/com/google/inject/AbstractModule.java
@@ -16,8 +16,9 @@
package com.google.inject;
-import com.google.inject.binder.BindingBuilder;
import com.google.inject.binder.ConstantBindingBuilder;
+import com.google.inject.binder.AnnotatedBindingBuilder;
+import com.google.inject.binder.LinkedBindingBuilder;
import com.google.inject.matcher.Matcher;
import com.google.inject.spi.SourceProviders;
import com.google.inject.util.Objects;
@@ -92,21 +93,21 @@
/**
* @see Binder#bind(Key)
*/
- protected <T> BindingBuilder<T> bind(Key<T> key) {
+ protected <T> LinkedBindingBuilder<T> bind(Key<T> key) {
return builder.bind(key);
}
/**
* @see Binder#bind(TypeLiteral)
*/
- protected <T> BindingBuilder<T> bind(TypeLiteral<T> typeLiteral) {
+ protected <T> AnnotatedBindingBuilder<T> bind(TypeLiteral<T> typeLiteral) {
return builder.bind(typeLiteral);
}
/**
* @see Binder#bind(Class)
*/
- protected <T> BindingBuilder<T> bind(Class<T> clazz) {
+ protected <T> AnnotatedBindingBuilder<T> bind(Class<T> clazz) {
return builder.bind(clazz);
}
diff --git a/src/com/google/inject/Binder.java b/src/com/google/inject/Binder.java
index 24d6e35..51593ef 100644
--- a/src/com/google/inject/Binder.java
+++ b/src/com/google/inject/Binder.java
@@ -16,8 +16,9 @@
package com.google.inject;
-import com.google.inject.binder.BindingBuilder;
import com.google.inject.binder.ConstantBindingBuilder;
+import com.google.inject.binder.AnnotatedBindingBuilder;
+import com.google.inject.binder.LinkedBindingBuilder;
import com.google.inject.matcher.Matcher;
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
@@ -53,17 +54,17 @@
/**
* Creates a binding to a key.
*/
- <T> BindingBuilder<T> bind(Key<T> key);
+ <T> LinkedBindingBuilder<T> bind(Key<T> key);
/**
* Creates a binding to a type.
*/
- <T> BindingBuilder<T> bind(TypeLiteral<T> typeLiteral);
+ <T> AnnotatedBindingBuilder<T> bind(TypeLiteral<T> typeLiteral);
/**
* Creates a binding to a type.
*/
- <T> BindingBuilder<T> bind(Class<T> type);
+ <T> AnnotatedBindingBuilder<T> bind(Class<T> type);
/**
* Binds a constant value to an annotation.
diff --git a/src/com/google/inject/BindingBuilderImpl.java b/src/com/google/inject/BindingBuilderImpl.java
index 0335303..09bed01 100644
--- a/src/com/google/inject/BindingBuilderImpl.java
+++ b/src/com/google/inject/BindingBuilderImpl.java
@@ -17,8 +17,8 @@
package com.google.inject;
import com.google.inject.BinderImpl.CreationListener;
-import com.google.inject.binder.BindingBuilder;
-import com.google.inject.binder.BindingScopeBuilder;
+import com.google.inject.binder.ScopedBindingBuilder;
+import com.google.inject.binder.AnnotatedBindingBuilder;
import com.google.inject.util.Annotations;
import com.google.inject.util.Objects;
import com.google.inject.util.StackTraceElements;
@@ -30,7 +30,7 @@
/**
* Binds a {@link com.google.inject.Key} to an implementation in a given scope.
*/
-class BindingBuilderImpl<T> implements BindingBuilder<T> {
+class BindingBuilderImpl<T> implements AnnotatedBindingBuilder<T> {
private static final Logger logger
= Logger.getLogger(BindingBuilderImpl.class.getName());
@@ -110,15 +110,15 @@
return this;
}
- public BindingScopeBuilder to(Class<? extends T> implementation) {
+ public ScopedBindingBuilder to(Class<? extends T> implementation) {
return to(TypeLiteral.get(implementation));
}
- public BindingScopeBuilder to(TypeLiteral<? extends T> implementation) {
+ public ScopedBindingBuilder to(TypeLiteral<? extends T> implementation) {
return to(Key.get(implementation));
}
- public BindingScopeBuilder to(Key<? extends T> targetKey) {
+ public ScopedBindingBuilder to(Key<? extends T> targetKey) {
ensureImplementationIsNotSet();
if (key.equals(targetKey)) {
@@ -151,7 +151,7 @@
return this;
}
- public BindingScopeBuilder toProvider(Provider<? extends T> provider) {
+ public ScopedBindingBuilder toProvider(Provider<? extends T> provider) {
ensureImplementationIsNotSet();
this.factory = new InternalFactoryToProviderAdapter<T>(provider, source);
registerInstanceForInjection(provider);
diff --git a/src/com/google/inject/binder/BindingAnnotationBuilder.java b/src/com/google/inject/binder/AnnotatedBindingBuilder.java
similarity index 75%
rename from src/com/google/inject/binder/BindingAnnotationBuilder.java
rename to src/com/google/inject/binder/AnnotatedBindingBuilder.java
index 1276d32..a5ddc08 100644
--- a/src/com/google/inject/binder/BindingAnnotationBuilder.java
+++ b/src/com/google/inject/binder/AnnotatedBindingBuilder.java
@@ -19,19 +19,20 @@
import java.lang.annotation.Annotation;
/**
- * Specifies the annotation of this binding.
+ * Specifies the annotation for a binding.
*
* @author crazybob@google.com (Bob Lee)
*/
-public interface BindingAnnotationBuilder<T> {
+public interface AnnotatedBindingBuilder<T> extends LinkedBindingBuilder<T> {
/**
* Specifies the marker annotation type for this binding.
*/
- BindingBuilder<T> annotatedWith(Class<? extends Annotation> annotationType);
+ LinkedBindingBuilder<T> annotatedWith(
+ Class<? extends Annotation> annotationType);
/**
* Specifies an annotation value for this binding.
*/
- BindingBuilder<T> annotatedWith(Annotation annotation);
+ LinkedBindingBuilder<T> annotatedWith(Annotation annotation);
}
diff --git a/src/com/google/inject/binder/BindingBuilder.java b/src/com/google/inject/binder/BindingBuilder.java
deleted file mode 100644
index aa87fe8..0000000
--- a/src/com/google/inject/binder/BindingBuilder.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * 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.binder;
-
-/**
- * Specifies the attributes of a binding.
- */
-public interface BindingBuilder<T> extends BindingAnnotationBuilder<T>,
- BindingImplementationBuilder<T>, BindingScopeBuilder {
-
-}
diff --git a/src/com/google/inject/binder/ConstantBindingBuilder.java b/src/com/google/inject/binder/ConstantBindingBuilder.java
index a6ef343..7a53798 100644
--- a/src/com/google/inject/binder/ConstantBindingBuilder.java
+++ b/src/com/google/inject/binder/ConstantBindingBuilder.java
@@ -17,7 +17,7 @@
package com.google.inject.binder;
/**
- * Javadoc.
+ * Binds to a constant value.
*/
public interface ConstantBindingBuilder {
diff --git a/src/com/google/inject/binder/BindingImplementationBuilder.java b/src/com/google/inject/binder/ImplementedBindingBuilder.java
similarity index 100%
rename from src/com/google/inject/binder/BindingImplementationBuilder.java
rename to src/com/google/inject/binder/ImplementedBindingBuilder.java
diff --git a/src/com/google/inject/binder/LinkedBindingBuilder.java b/src/com/google/inject/binder/LinkedBindingBuilder.java
deleted file mode 100644
index 4fc37bb..0000000
--- a/src/com/google/inject/binder/LinkedBindingBuilder.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * 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.binder;
-
-import com.google.inject.Key;
-import com.google.inject.TypeLiteral;
-
-/**
- * Javadoc.
- *
- */
-public interface LinkedBindingBuilder<T> {
-
- /**
- * Links to another binding with the given key.
- */
- void to(Key<? extends T> destination);
-
- /**
- * Links to another binding with the given type.
- */
- void to(Class<? extends T> destination);
-
- /**
- * Links to another binding with the given type.
- */
- void to(TypeLiteral<? extends T> destination);
-}
diff --git a/src/com/google/inject/binder/BindingScopeBuilder.java b/src/com/google/inject/binder/ScopedBindingBuilder.java
similarity index 96%
rename from src/com/google/inject/binder/BindingScopeBuilder.java
rename to src/com/google/inject/binder/ScopedBindingBuilder.java
index b7dce43..bd5e1b4 100644
--- a/src/com/google/inject/binder/BindingScopeBuilder.java
+++ b/src/com/google/inject/binder/ScopedBindingBuilder.java
@@ -24,7 +24,7 @@
*
* @author crazybob@google.com (Bob Lee)
*/
-public interface BindingScopeBuilder {
+public interface ScopedBindingBuilder {
/**
* Specifies the scope. References the annotation passed to {@link