For calling methods you can use AOP. bindInterceptor(any(), usesRequestParam(), new RequestParamInterceptor ());
For injecting the stuff it is not that easy. Take a look here http://groups.google.com/group/google-guice/browse_thread/thread/ab74434dc7e03dfd/. Cheers Alen On Dec 2, 6:34 pm, John G <[email protected]> wrote: > Hello, > > I see we have @RequestParameters in Guice 2.0, but what I was looking > to use/implement was more like Spring's @RequestParam. I apologize in > advance if this is already available. > > i.e in Spring 2.5 > > public void show(@RequestParam("number") String number, Map<String, > Object> model) { > model.put("account", accountRepository.findAccount(number)); > } > > It doesn't look to be available in Guice. Is it on roadmap? In > meantime I thought I could implement creating my own annotation > > public @interface RequestParameter { > public String name(); > > } > > and would inject into my class: > > @Inject @RequestParameter(name="myId") String myId; > > I'm not seeing any way to pass the name="myId" into anything that > could react to the annotation attribute, be it a provider or any other > way. Is this possible, or am I way off? > > For example: > binder.bind(String.class).annotatedWith > (RequestParameter.class).toProvider(RequestParameterProvider.class); > > how would I get "myId' to provider or any other "thing" which can read > from the annotation attribute? > > Thanks, > John -- 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.
