do you mean value of the argument? methodArguments[i]?
On Tue, May 8, 2012 at 1:12 PM, Carlos Alexandro Becker <caarl...@gmail.com>wrote: > hmm > > I still don't understanding how can I get the value of the parameter.. > > > On Tuesday, May 8, 2012 2:06:44 PM UTC-3, Fred Faber wrote: >> >> http://code.google.com/p/**google-guice/source/search?q=** >> Named&origq=Named&btnG=Search+**Trunk<http://code.google.com/p/google-guice/source/search?q=Named&origq=Named&btnG=Search+Trunk> >> >> On Tue, May 8, 2012 at 12:59 PM, Carlos Alexandro Becker < >> caarl...@gmail.com> wrote: >> >>> hmm.. but this way, how I get the value of the field? >>> >>> thanks. >>> >>> >>> On Monday, May 7, 2012 2:11:54 PM UTC-3, Fred Faber wrote: >>>> >>>> Yes, something like this: >>>> >>>> void findAnnotatedArguments(MethodI****nvocation methodInvocation) { >>>> Method method = methodInvocation.getMethod(); checkArgument( >>>> method.isAnnotationPresent(Req****uiresPermission.class), >>>> "Unexpected method passed to the Interceptor: %s", method); >>>> Object[] methodArguments = methodInvocation.getArguments(****); Type[] >>>> genericParameterTypes = method.**getGenericParameterType**s(); >>>> Annotation[][] annotationsOfParameters = >>>> method.**getParameterAnnotations**(); for (int i = 0; i < >>>> annotationsOfParameters.**length**; i++) { Annotation[] >>>> annotationsOfParameter = annotationsOfParameters[i]; >>>> for (Annotation annotation : annotationsOfParameter) { >>>> if (Named.class.isInstance(**annota**tion)) { >>>> >>>> ... do whatever you want >>>> } >>>> } >>>> } >>>> } >>>> >>>> >>>> On Mon, May 7, 2012 at 12:09 PM, Carlos Alexandro Becker < >>>> caarl...@gmail.com> wrote: >>>> >>>>> I'm taking a look at guice aop integration... and wonder something: >>>>> >>>>> If I have a named parameter like this: >>>>> >>>>> @RequiresPermission(permission = Permission.WRITE) >>>>> public void needsWrite(@Named("test") User u, @Named("test2") String >>>>> t) { >>>>> System.out.println("I write something :) " + t); >>>>> } >>>>> >>>>> Can I get these parameters by Named annotations in my method >>>>> interceptor? >>>>> >>>>> Thanks >>>>> >>>>> -- >>>>> You received this message because you are subscribed to the Google >>>>> Groups "google-guice" group. >>>>> To view this discussion on the web visit https://groups.google.com/d/* >>>>> *ms**g/google-guice/-/**FjI8kHjOB9oJ<https://groups.google.com/d/msg/google-guice/-/FjI8kHjOB9oJ> >>>>> . >>>>> To post to this group, send email to google-guice@googlegroups.com. >>>>> To unsubscribe from this group, send email to >>>>> google-guice+unsubscribe@**googl**egroups.com<google-guice%2bunsubscr...@googlegroups.com> >>>>> . >>>>> For more options, visit this group at http://groups.google.com/**group >>>>> **/google-guice?hl=en<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-guice@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.