"Argument set" - how are you going to get different values into the type? Assuming

class Foo {
  @Inject Foo (Bar b, Blah bl) {...}
}

then how will you get different Bars and Blahs into these? Guice will have one and only one configuration for the above, so you won't get combinations and permutations, unless you do complex things with scopes.

I think you probably want a memoizing factory of some kind - takes in the inputs and guarantees only one instance out for a given set of inputs. This seems outside of the scope of Guice itself, though perhaps I'm misunderstanding your use case.

c.


On 20 Feb 2014, at 8:36, Francis Galiegue wrote:

Hello,

Hypothesis:

* I have thread-safe classes which I want to create via constructor injection;
* all arguments to constructors of these classes implement .equals()
and .hashCode().

Can Guice, in a thread-safe way, ensure that only one instance is
created for each "equal argument set"?

--
Francis Galiegue, [email protected]
JSON Schema in Java: http://json-schema-validator.herokuapp.com

--
You received this message because you are subscribed to the Google Groups "google-guice" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-guice.
For more options, visit https://groups.google.com/groups/opt_out.


Christian Gruber :: Google, Inc. :: Java Core Libraries :: Dependency Injection
email: [email protected] :::: mobile: +1 (646) 807-9839

--
You received this message because you are subscribed to the Google Groups 
"google-guice" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-guice.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to