/** * Completely scan a class for annotations * @param cls * @return true if the class has annotations, false otherwise */ protected boolean hasAnnotations(Class<?> cls) { if(cls == null) return false; // Note: this also returns true if super class has annotations if(cls.getAnnotations().length > 0) return true; for(Method m : cls.getDeclaredMethods()) { if(m.getAnnotations().length > 0) return true; } for(Field f : cls.getDeclaredFields()) { if(f.getAnnotations().length > 0) return true; } return hasAnnotations(cls.getSuperclass()); }
boolean hasAnnotations = hasAnnotations(c); boolean includeClass = false; if(clientClassName != null)