/** * Checks if annotation is presented on a field or method of the specified object. * * @param target Target object. * @param annCls Annotation class to find on fields or methods of target object. * @param dep Deployment. * @return {@code true} if annotation is presented, {@code false} if it's not. */ boolean isAnnotationPresent(Object target, Class<? extends Annotation> annCls, @Nullable GridDeployment dep) { assert target != null; assert annCls != null; Class<?> targetCls = target.getClass(); Set<Class<?>> skipClss = skipCache.get(annCls); if (skipClss != null && skipClss.contains(targetCls)) return false; List<GridResourceField> fields = getFieldsWithAnnotation(dep, targetCls, annCls); if (!fields.isEmpty()) return true; List<GridResourceMethod> mtds = getMethodsWithAnnotation(dep, targetCls, annCls); if (mtds.isEmpty()) { if (skipClss == null) skipClss = F.addIfAbsent(skipCache, annCls, F.<Class<?>>newCSet()); skipClss.add(targetCls); return false; } return true; }
for (GridResourceField field : getFieldsWithAnnotation(dep, targetCls, annCls)) { Field f = field.getField();