Revision: 1491
Author: sberlin
Date: Sun Feb  6 09:59:07 2011
Log: issues 592 & 591, documentation updates.
http://code.google.com/p/google-guice/source/detail?r=1491

Modified:
 /trunk/core/src/com/google/inject/ProvisionException.java
/trunk/extensions/assistedinject/src/com/google/inject/assistedinject/FactoryModuleBuilder.java

=======================================
--- /trunk/core/src/com/google/inject/ProvisionException.java Sat Jul 3 08:51:31 2010 +++ /trunk/core/src/com/google/inject/ProvisionException.java Sun Feb 6 09:59:07 2011
@@ -34,7 +34,7 @@

   private final ImmutableSet<Message> messages;

-  /** Creates a ConfigurationException containing {@code messages}. */
+  /** Creates a ProvisionException containing {@code messages}. */
   public ProvisionException(Iterable<Message> messages) {
     this.messages = ImmutableSet.copyOf(messages);
     checkArgument(!this.messages.isEmpty());
=======================================
--- /trunk/extensions/assistedinject/src/com/google/inject/assistedinject/FactoryModuleBuilder.java Wed Nov 3 06:08:56 2010 +++ /trunk/extensions/assistedinject/src/com/google/inject/assistedinject/FactoryModuleBuilder.java Sun Feb 6 09:59:07 2011
@@ -97,6 +97,26 @@
  *
* As a side-effect of this binding, Guice will inject the factory to initialize it for use. The
  * factory cannot be used until the injector has been initialized.
+ *
+ * <h3>Configuring complex factories</h3>
+ * Factories can create an arbitrary number of objects, one per each method. Each factory
+ * method can be configured using <code>.implement</code>.
+ *
+ * <pre>public interface OrderFactory {
+ *    Payment create(Date startDate, Money amount);
+ *    Shipment create(Customer customer, Item item);
+ *    Receipt create(Payment payment, Shipment shipment);
+ * }
+ *
+ * [...]
+ *
+ * install(new FactoryModuleBuilder()
+ *     .implement(Payment.class, RealPayment.class)
+ *     // excluding .implement for Shipment means the implementation class
+ * // will be 'Shipment' itself, which is legal if it's not an interface.
+ *     .implement(Receipt.class, RealReceipt.class)
+ *     .build(OrderFactory.class);</pre>
+ * </pre>
  *
  * <h3>Using the factory</h3>
* Inject your factory into your application classes. When you use the factory, your arguments

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