Author: limpbizkit
Date: Wed Sep 24 13:24:40 2008
New Revision: 625
Modified:
wiki/Scopes.wiki
Log:
Edited wiki page through web user interface.
Modified: wiki/Scopes.wiki
==============================================================================
--- wiki/Scopes.wiki (original)
+++ wiki/Scopes.wiki Wed Sep 24 13:24:40 2008
@@ -4,16 +4,16 @@
Scopes are one of Guice's most powerful features.
-= Scope Application =
+= Applying Scopes =
-Prefer to apply scopes using an annotation on the implementing class. This
provides a helpful hint to the code's maintainer. For example, [EMAIL
PROTECTED]
indicates that a class must be threadsafe.
+Prefer to apply scopes using an annotation on the implementing class. This
provides helpful information to the code's maintainer. For example,
[EMAIL PROTECTED] indicates that a class must be threadsafe.
Scopes are applied to the binding source, not the binding target. For
example, suppose we have a class `Applebees` that implements both `Bar` and
`Grill` interfaces. These bindings will allow for *two* instances of that
type, one for `Bar`s and another for `Grill`s:
{{{
bind(Bar.class).to(Applebees.class).in(Singleton.class);
bind(Grill.class).to(Applebees.class).in(Singleton.class);
}}}
-This is because the scopes apply to the bound type, not the type that
satisfies that binding. To allow only a single instance of our
implementation class to be created, use a [EMAIL PROTECTED] annotation on the
declaration for that class. Or add yet another binding:
+This is because the scopes apply to the bound type (`Bar`, `Grill`), not
the type that satisfies that binding (`Applebees`). To allow only a single
instance of our implementation class to be created, use a [EMAIL PROTECTED]
annotation on the declaration for that class. Or add yet another binding:
{{{
bind(Applebees.class).in(Singleton.class);
}}}
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---