Author: limpbizkit
Date: Tue Dec 30 23:45:46 2008
New Revision: 757

Modified:
    wiki/Changes20.wiki

Log:
Edited wiki page through web user interface.

Modified: wiki/Changes20.wiki
==============================================================================
--- wiki/Changes20.wiki (original)
+++ wiki/Changes20.wiki Tue Dec 30 23:45:46 2008
@@ -9,8 +9,25 @@
    * `Scopes.NO_SCOPE` allows you make no-scoping explicit.
    * `Matcher.inSubpackage` matches all classes in any child package of the  
given one.
    * `Types` utility class for creating implementations of generic types.
+  * `AbstractModule.requireBinding` allows modules to document  
dependencies programatically

  ==Provider Methods==
+Creating custom providers without all of the boilerplate. In any module,  
annotate a method with `...@provides` to define logic that will be used to  
provide that type:
+{{{
+class PaymentsModule extends AbstractModule {
+  public void configure() {
+    ...
+  }
+
+  @Provides @Singleton
+  PaymentService providePaymentService(CustomerDb database) {
+    DatabasePaymentService result = new DatabasePaymentService();
+    result.setDatabase(database);
+    result.setReplicationLevel(5);
+    return result;
+  }
+}}}
+Parameters to the @Provides method will be injected. It can optionally be  
annotated with a scoping annotation (like `...@singleton`). The method's  
returned type is the bound type. Annotate the method with a binding  
annotation (like `...@named("replicated")`) to create a binding for the  
annotated type.

  ==Binding Overrides==
  [http://publicobject.com/2008/05/overriding-bindings-in-guice.html  
Override] the bindings from one module with another:
@@ -37,13 +54,15 @@
   
[http://google-guice.googlecode.com/svn/trunk/latest-javadoc/com/google/inject/privatemodules/PrivateModule.html
  
PrivateModules] can be used to create bindings that are not externally  
visible. This makes it easier to encapsulate dependencies and to avoid bind  
conflicts.

  ==Servlets==
-Servlets can be injected via `InjectedHttpServlet` and  
`GuiceServletContextListener`.
+`ServletModule` now supports programmatic configuration of servlets and  
filters. These servlets may be injected directly.
+
+`GuiceServletContextListener` can be used to help bootstrap a Guice  
application in a servlet container.

  ==Child Injectors==
   
[http://google-guice.googlecode.com/svn/trunk/latest-javadoc/com/google/inject/Injector.html#createChildInjector(java.lang.Iterable)
  
Injector.createChildInjector] allows you to create child injectors that  
inherit the bindings, scopes, interceptors and converters of their parent.  
This API is primarily intended for extensions and tools.

  ==Even Better Error Reporting==
-Exceptions in Guice 1.0 tend to include long chains of 'caused by'  
exceptions. We've tidied this up! Now a single !ProvisionException  
describes concisely what Guice was doing when the problem occurred.
+Exceptions in Guice 1.0 tend to include long chains of 'caused by'  
exceptions. We've tidied this up! Now a single exception describes  
concisely what Guice was doing when the problem occurred.

  ==Introspection API==
  Like `java.lang.reflect`, but for Guice. It lets you rewrite a Module,  
tweaking bindings programatically. It also lets you inspect a created  
injector, and examine its bindings. This is intended to enable simpler,  
more powerful extensions and tools for Guice.
@@ -55,16 +74,18 @@
  Guice does bytecode generation internally to implement AOP. In version  
2.0, generated classes are loaded by a bridge classloader that works in  
managed environments such as OSGi.

  ==Type Resolution==
-[http://groups.google.com/group/google-guice/browse_thread/thread/1355313a074d8094/88270edbbeae2df8
  
Parameterized  
injection points] allow you to inject types like `Reducer<T>`  
or `Converter<A, B>`. Guice will figure out what `T` is and find the  
binding for that type.  
[http://publicobject.com/2008/11/guice-punches-erasure-in-face.html  
TypeLiteral injection] means you can inject a `TypeLiteral<T>` into your  
classes. Use this to reify  
[http://java.sun.com/docs/books/tutorial/java/generics/erasure.html Java 5  
type erasure].
+[http://groups.google.com/group/google-guice/browse_thread/thread/1355313a074d8094/88270edbbeae2df8
  
Parameterized  
injection points] allow you to inject types like `Reducer<T>`  
or `Converter<A, B>`. Guice will figure out what `T` is and find the  
binding for that type.  
[http://publicobject.com/2008/11/guice-punches-erasure-in-face.html  
TypeLiteral injection] means you can inject a `TypeLiteral<T>` into your  
classes. Use this to reify  
[http://java.sun.com/docs/books/tutorial/java/generics/erasure.html Java 5  
type erasure]. The `TypeLiteral` class now includes library methods for  
manual type resolution.

  =Changes since 1.0=

   
[http://google-guice.googlecode.com/svn/trunk/latest-api-diffs/changes.html  
JDiff change report]

  ==Exception Types==
-In Guice 1.0, when a custom provider throws an unchecked exception,  
sometimes Guice wraps the exception and sometimes it doesn't. It depends on  
whether the provider is being called directly (via Provider.get()) or  
indirectly (such as for injecting into another type).
+In Guice 1.0, when a custom provider throws an unchecked exception,  
sometimes Guice wraps the exception and sometimes it doesn't. This depends  
on whether the provider is being called directly (via Provider.get()) or  
indirectly (such as for injecting into another type).
+
+In Guice 2.0, any time a provider or injection throws, Guice wraps it in  
a !ProvisionException.  
[http://publicobject.com/2008/04/future-guice-providers-that-throw.html  
This rule is simpler], and it makes it easier to write fault-tolerant code  
with Guice.

-In Guice 2.0, any time a custom provider throws, Guice wraps it in  
a !ProvisionException.  
[http://publicobject.com/2008/04/future-guice-providers-that-throw.html  
This rule is simpler], and it makes it easier to write fault-tolerant code  
with Guice.
+Injector creation problems are always reported as !CreationException.  
Runtime configuration problems (ie. programmer errors) are always reported  
as !ConfigurationException.

  !ProvisionException, !ConfigurationException and !OutOfScopeException are  
now public.


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to