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 <[email protected] > 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.**getGenericParameterTypes(); >> Annotation[][] annotationsOfParameters = method.**getParameterAnnotations(); >> for (int i = 0; i < annotationsOfParameters.**length; i++) { >> Annotation[] annotationsOfParameter = annotationsOfParameters[i]; >> for (Annotation annotation : annotationsOfParameter) { >> if (Named.class.isInstance(**annotation)) { >> ... do whatever you want >> } >> } >> } >> } >> >> >> On Mon, May 7, 2012 at 12:09 PM, Carlos Alexandro Becker < >> [email protected]> 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/** >>> msg/google-guice/-/**FjI8kHjOB9oJ<https://groups.google.com/d/msg/google-guice/-/FjI8kHjOB9oJ> >>> . >>> To post to this group, send email to [email protected]. >>> To unsubscribe from this group, send email to google-guice+unsubscribe@* >>> *googlegroups.com <google-guice%[email protected]>. >>> 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 [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.
