Sounds like AssistedInject might fit the bill for you:
interface MyCompositeFactory {
MyComposite create(String id, String name);
}
...
class MyComposite extends Composite implements YourView {
@Inject MyComposite(
EventBus eventBus,
@Assisted String id,
@Assisted String name) {
....
}
}
Fred
On Wed, Feb 23, 2011 at 12:15 PM, Gambo <[email protected]> wrote:
> Hi there,
>
> I have a question regarding passing constructor parameter which are
> not injected by guice. I have a GWT composite object and I want to
> generate this via:
>
> MyComposite comp = new MyComposite("id", "name");
>
> Later on i am adding it to my view. Further in MyComposite I want to
> make use of the EventBus which is not seen outside of the object and
> should be injected automaticaly internally within the composite
> object. Sadly Guice always wants at least a default contructor if I
> dont annotate with @Inject.
>
> Is there a more elegant way or is the approach completely wrong.
>
> Thanks for your help!
>
> --
> You received this message because you are subscribed to the Google Groups
> "google-guice" 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?hl=en.
>
>
--
You received this message because you are subscribed to the Google Groups
"google-guice" 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?hl=en.