Comment by Leigh.Klotz:

It would nice to have something on "Making parameter types distinct" here.

http://google-guice.googlecode.com/svn/trunk/latest-javadoc/com/google/inject/assistedinject/FactoryProvider.html

Making parameter types distinct
The types of the factory method's parameters must be distinct. To use  
multiple parameters of the same type, use a named @Assisted annotation to  
disambiguate the parameters. The names must be applied to the factory  
method's parameters:

public interface PaymentFactory {
    Payment create(
        @Assisted("startDate") Date startDate,
        @Assisted("dueDate") Date dueDate,
        Money amount);
  }

...and to the concrete type's constructor parameters:

public class RealPayment implements Payment {
    @Inject
    public RealPayment(
       CreditService creditService,
       AuthService authService,
       @Assisted("startDate") Date startDate,
       @Assisted("dueDate") Date dueDate,
       @Assisted Money amount) {
      ...
    }
  }


For more information:
http://code.google.com/p/google-guice/wiki/AssistedInject

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