Revision: 1064 Author: limpbizkit Date: Wed Aug 19 11:31:04 2009 Log: Jesse's tweaks to aragos' patch r1063. His patch was quite well implemented and these changes are mostly pedantic.
Most notably, I un-deprecated FactoryProvider, replacing the deprecation tag with an obsolete warning. We should make a best effort to fix deprecated callers before we deprecate something, otherwise we're punishing our users for our own mistakes. http://code.google.com/p/google-guice/source/detail?r=1064 Modified: /trunk/extensions/assistedinject/src/com/google/inject/assistedinject/BindingCollector.java /trunk/extensions/assistedinject/src/com/google/inject/assistedinject/FactoryModuleBuilder.java /trunk/extensions/assistedinject/src/com/google/inject/assistedinject/FactoryProvider.java /trunk/extensions/assistedinject/src/com/google/inject/assistedinject/FactoryProvider2.java ======================================= --- /trunk/extensions/assistedinject/src/com/google/inject/assistedinject/BindingCollector.java Wed Aug 19 11:18:16 2009 +++ /trunk/extensions/assistedinject/src/com/google/inject/assistedinject/BindingCollector.java Wed Aug 19 11:31:04 2009 @@ -18,13 +18,14 @@ import com.google.inject.ConfigurationException; import com.google.inject.Key; import com.google.inject.TypeLiteral; +import com.google.inject.internal.ImmutableSet; import com.google.inject.internal.Maps; import com.google.inject.spi.Message; import java.util.Collections; import java.util.Map; /** - * Utility class for collecting factory bindings. Used for configuring {...@link FactoryProvider2}. + * Utility class for collecting factory bindings. Used for configuring {...@link FactoryProvider2}. * * @author [email protected] (Peter Schmitt) */ @@ -34,7 +35,7 @@ public BindingCollector addBinding(Key<?> key, TypeLiteral<?> target) { if (bindings.containsKey(key)) { - throw new ConfigurationException(Collections.singleton( + throw new ConfigurationException(ImmutableSet.of( new Message("Only one implementation can be specified for " + key))); } ======================================= --- /trunk/extensions/assistedinject/src/com/google/inject/assistedinject/FactoryModuleBuilder.java Wed Aug 19 11:18:16 2009 +++ /trunk/extensions/assistedinject/src/com/google/inject/assistedinject/FactoryModuleBuilder.java Wed Aug 19 11:31:04 2009 @@ -39,11 +39,11 @@ * or <i>newPayment</i>. * * <h3>Creating a type that accepts factory parameters</h3> - * {...@code constructedType} is a concrete class with an {...@literal @}...@link Inject}-annotated - * constructor. In addition to injector-supplied parameters, the constructor should have - * parameters that match each of the factory method's parameters. Each factory-supplied parameter - * requires an {...@literal @}...@link Assisted} annotation. This serves to document that the parameter - * is not bound by your application's modules. + * {...@code constructedType} is a concrete class with an {...@literal @}...@link com.google.inject.Inject + * Inject}-annotated constructor. In addition to injector-supplied parameters, the constructor + * should have parameters that match each of the factory method's parameters. Each factory-supplied + * parameter requires an {...@literal @}...@link Assisted} annotation. This serves to document that the + * parameter is not bound by your application's modules. * * <pre>public class RealPayment implements Payment { * {...@literal @}Inject @@ -162,7 +162,6 @@ * .build(AnimalFactory.class)); * }</pre> * - * * @author [email protected] (Peter Schmitt) */ public class FactoryModuleBuilder { ======================================= --- /trunk/extensions/assistedinject/src/com/google/inject/assistedinject/FactoryProvider.java Wed Aug 19 11:18:16 2009 +++ /trunk/extensions/assistedinject/src/com/google/inject/assistedinject/FactoryProvider.java Wed Aug 19 11:31:04 2009 @@ -43,7 +43,10 @@ import java.util.Set; /** - * Provides a factory that combines the caller's arguments with injector-supplied values to + * <strong>Obsolete.</strong> Prefer {...@link FactoryModuleBuilder} for its more concise API and + * additional capability. + * + * <p>Provides a factory that combines the caller's arguments with injector-supplied values to * construct objects. * * <h3>Defining a factory</h3> @@ -139,10 +142,7 @@ * @author [email protected] (Jerome Mourits) * @author [email protected] (Jesse Wilson) * @author [email protected] (Daniel Martin) - * - * @deprecated Use {...@link FactoryModuleBuilder} instead. */ -...@deprecated public class FactoryProvider<F> implements Provider<F>, HasDependencies { /* @@ -172,7 +172,7 @@ // Preserving backwards-compatibility: Map all return types in a factory // interface to the passed implementation type. Errors errors = new Errors(); - Key implementationKey = Key.get(implementationType); + Key<?> implementationKey = Key.get(implementationType); if (implementationType != null) { try { ======================================= --- /trunk/extensions/assistedinject/src/com/google/inject/assistedinject/FactoryProvider2.java Wed Aug 19 11:18:16 2009 +++ /trunk/extensions/assistedinject/src/com/google/inject/assistedinject/FactoryProvider2.java Wed Aug 19 11:31:04 2009 @@ -50,6 +50,7 @@ * * @author [email protected] (Jesse Wilson) * @author [email protected] (Daniel Martin) + * @author [email protected] (Peter Schmitt) */ final class FactoryProvider2<F> implements InvocationHandler, Provider<F> { --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
