/** * Gets the given class's {@link Field}s marked with the annotation of the * specified class. * <p> * Unlike {@link Class#getFields()}, the result will include any non-public * fields, including fields defined in supertypes of the given class. * </p> * * @param c The class to scan for annotated fields. * @param annotationClass The type of annotation for which to scan. * @param fields The list to which matching fields will be added. */ public static <A extends Annotation> void getAnnotatedFields( final Class<?> c, final Class<A> annotationClass, final List<Field> fields) { List<Field> cachedFields = fieldCache.getList(c, annotationClass); if (cachedFields == null) { final Query query = new Query(); query.put(annotationClass, Field.class); cacheAnnotatedObjects(c, query); cachedFields = fieldCache.getList(c, annotationClass); } fields.addAll(cachedFields); }
/** * Gets the given class's {@link Field}s marked with the annotation of the * specified class. * <p> * Unlike {@link Class#getFields()}, the result will include any non-public * fields, including fields defined in supertypes of the given class. * </p> * * @param c The class to scan for annotated fields. * @param annotationClass The type of annotation for which to scan. * @param fields The list to which matching fields will be added. */ public static <A extends Annotation> void getAnnotatedFields( final Class<?> c, final Class<A> annotationClass, final List<Field> fields) { List<Field> cachedFields = fieldCache.getList(c, annotationClass); if (cachedFields == null) { final Query query = new Query(); query.put(annotationClass, Field.class); cacheAnnotatedObjects(c, query); cachedFields = fieldCache.getList(c, annotationClass); } fields.addAll(cachedFields); }
/** * Gets the given class's {@link Method}s marked with the annotation of the * specified class. * <p> * Unlike {@link Class#getMethods()}, the result will include any non-public * methods, including methods defined in supertypes of the given class. * </p> * * @param c The class to scan for annotated methods. * @param annotationClass The type of annotation for which to scan. * @param methods The list to which matching methods will be added. */ public static <A extends Annotation> void getAnnotatedMethods(final Class<?> c, final Class<A> annotationClass, final List<Method> methods) { List<Method> cachedMethods = methodCache.getList(c, annotationClass); if (cachedMethods == null) { final Query query = new Query(); query.put(annotationClass, Method.class); cacheAnnotatedObjects(c, query); cachedMethods = methodCache.getList(c, annotationClass); } if (cachedMethods != null) methods.addAll(cachedMethods); }
/** * Gets the given class's {@link Method}s marked with the annotation of the * specified class. * <p> * Unlike {@link Class#getMethods()}, the result will include any non-public * methods, including methods defined in supertypes of the given class. * </p> * * @param c The class to scan for annotated methods. * @param annotationClass The type of annotation for which to scan. * @param methods The list to which matching methods will be added. */ public static <A extends Annotation> void getAnnotatedMethods(final Class<?> c, final Class<A> annotationClass, final List<Method> methods) { List<Method> cachedMethods = methodCache.getList(c, annotationClass); if (cachedMethods == null) { final Query query = new Query(); query.put(annotationClass, Method.class); cacheAnnotatedObjects(c, query); cachedMethods = methodCache.getList(c, annotationClass); } if (cachedMethods != null) methods.addAll(cachedMethods); }
if (superClass != null) { cacheAnnotatedObjects(superClass, new Query(query)); inherited.add(superClass); cacheAnnotatedObjects(ifaceClass, new Query(query)); inherited.add(ifaceClass);
if (superClass != null) { cacheAnnotatedObjects(superClass, new Query(query)); inherited.add(superClass); cacheAnnotatedObjects(ifaceClass, new Query(query)); inherited.add(ifaceClass);
query.put(Parameter.class, Field.class); query.put(EventHandler.class, Method.class); ClassUtils.cacheAnnotatedObjects(o.getClass(), query);
query.put(Parameter.class, Field.class); query.put(EventHandler.class, Method.class); ClassUtils.cacheAnnotatedObjects(o.getClass(), query);