Revision: 1122
Author: christianedwardgruber
Date: Sat Nov 7 15:35:10 2009
Log: Edited wiki page through web user interface.
http://code.google.com/p/google-guice/source/detail?r=1122
Modified:
/wiki/LinkedBindings.wiki
=======================================
--- /wiki/LinkedBindings.wiki Mon Mar 2 21:03:07 2009
+++ /wiki/LinkedBindings.wiki Sat Nov 7 15:35:10 2009
@@ -23,3 +23,12 @@
}
}}}
In this case, when a `TransactionLog` is requested, the injector will
return a `MySqlDatabaseTransactionLog`.
+
+While it is not recommended practice, sometimes you might need to bind a
concrete class without having an interface to which to bind it. For
instance, you may have a class you need from a library whose source you do
not control, and therefore cannot abstract an interface from the class. In
this case, you need only bind the class without binding it _to_ anything,
like so:
+{{{
+ @Override
+ protected void configure() {
+ bind(MyConcreteClass.class);
+ }
+}}}
+Guice infers that the class is both the key type AND the implementation.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"google-guice-dev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/google-guice-dev?hl=en
-~----------~----~----~----~------~----~------~--~---