Use bind(*new TypeLiteral<MaxBoundSet<String>>(){*}).[....] instead of bind(
*MaxBoundSet.class*).[...].

This tells Guice that you want a typed version of the set.  The funky syntax
is because you're creating a subclass of TypeLiteral so that Java can retain
the generics information at runtime, allowing Guice to do its magic.

sam

On Tue, Dec 14, 2010 at 6:09 PM, Peter <tableyourt...@googlemail.com> wrote:

> both suggestions pointed me in the right direction ... thanks for
> them!
>
> Now I'm using:
>
> @Inject
> private Provider<MaxBoundSet> lastSearches;
> // along with
> bind(MaxBoundSet.class).toInstance(new MaxBoundSet<String>(30,
> 60).setMaxAge(10 * 60 * 1000));
>
> the following line won't work!
> @Inject
> private Provider<MaxBoundSet<String>> lastSearches;
>
> this will call the default constructor (which I don't want)!
>
> maybe this generic thing is a bug in wicket-guice or in guice itself?
>
> Regards,
> Peter.
>
>
> On 14 Dez., 04:05, Brian Lough <bklo...@comcast.net> wrote:
> > Warp-persist has it's own configure() -- might want to double-check
> you're
> > binding what you think you are ash you shouldn't have the problem you
> > described.
> >
> > My ServicesModule do this sort of thing all the time with no injection
> > problems:
> >
> > public class ServicesModule extends AbstractModule {
> > private static final String HIBERNATE_CONFIG = "/hibernate.properties";
> >  @Override
> > protected void configure() {
> >                 // wad of other stuffage
> > bind(Logger.class).toInstance(LoggerFactory.getLogger("StdOut"));
> >          }
> >
> > }
>
> --
> You received this message because you are subscribed to the Google Groups
> "google-guice" group.
> To post to this group, send email to google-gu...@googlegroups.com.
> To unsubscribe from this group, send email to
> google-guice+unsubscr...@googlegroups.com<google-guice%2bunsubscr...@googlegroups.com>
> .
> 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 google-gu...@googlegroups.com.
To unsubscribe from this group, send email to 
google-guice+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-guice?hl=en.

Reply via email to