I want to get a class's (packaged in jar file) annotation parameters by java reflect.
My annotation like this
@Documented @Retention(RUNTIME) @Target(TYPE) public @interface TestPlugin { public String moduleName(); public String plugVersion(); public String minLeapVersion(); }
My class like this
@TestPlugin(moduleName="xxx", plugVersion="1.0.0", minLeapVersion="1.3.0") public class Plugin { ...... }
My access code like this
Class<?> clazz = this.loadClass(mainClassName); // myself classloader Annotation[] annos = clazz.getAnnotations(); for (Annotation anno : annos) { Class<? extends Annotation> annoClass = anno.annotationType(); /* Question is here This code can get right annotationType: @TestPlugin. Debug windows show anno is $Proxy33. But I can't find any method to get annotation membervalues even though I can find them in debug windows. How can I get annotation's parameters? */ }