Added convenience methods for link().
git-svn-id: https://google-guice.googlecode.com/svn/trunk@159 d779f126-a31b-0410-b53b-1d3aecad763e
diff --git a/src/com/google/inject/ContainerBuilder.java b/src/com/google/inject/ContainerBuilder.java
index e59848d..0f3b13a 100644
--- a/src/com/google/inject/ContainerBuilder.java
+++ b/src/com/google/inject/ContainerBuilder.java
@@ -207,6 +207,22 @@
}
/**
+ * Links the given type to another key effectively creating an alias for a
+ * binding.
+ */
+ public <T> LinkedBindingBuilder<T> link(Class<T> type) {
+ return link(Key.get(type));
+ }
+
+ /**
+ * Links the given type to another key effectively creating an alias for a
+ * binding.
+ */
+ public <T> LinkedBindingBuilder<T> link(TypeLiteral<T> type) {
+ return link(Key.get(type));
+ }
+
+ /**
* Binds a constant to the given annotation.
*/
public ConstantBindingBuilder bindConstant(Annotation annotation) {
@@ -988,6 +1004,20 @@
this.destination = destination;
}
}
+
+ /**
+ * Links to another binding with the given type.
+ */
+ public void to(Class<? extends T> destination) {
+ to(Key.get(destination));
+ }
+
+ /**
+ * Links to another binding with the given type.
+ */
+ public void to(TypeLiteral<? extends T> destination) {
+ to(Key.get(destination));
+ }
}
/**