/** * Gets set of methods with given annotation. * * @param dep Deployment. * @param cls Class in which search for methods. * @param annCls Annotation. * @return Set of methods with given annotations. */ List<GridResourceMethod> getMethodsWithAnnotation(@Nullable GridDeployment dep, Class<?> cls, Class<? extends Annotation> annCls) { List<GridResourceMethod> mtds = getMethodsFromCache(cls, annCls); if (mtds == null) { mtds = new ArrayList<>(); for (Class cls0 = cls; !cls0.equals(Object.class); cls0 = cls0.getSuperclass()) { for (Method mtd : cls0.getDeclaredMethods()) { Annotation ann = mtd.getAnnotation(annCls); if (ann != null) mtds.add(new GridResourceMethod(mtd, ann)); } } cacheMethods(dep, cls, annCls, mtds); } return mtds; }