@Test public void collect_does_fetch_mustbedocumented__on_method_field_and_type_by_reflections() throws Exception { collectorToTest.collect(); verify(reflections).getMethodsAnnotatedWith(MustBeDocumented.class); verify(reflections).getFieldsAnnotatedWith(MustBeDocumented.class); verify(reflections).getTypesAnnotatedWith(MustBeDocumented.class); }
public List<DocAnnotationData> collect() { Class<? extends Annotation> annotation = MustBeDocumented.class; Set<Class<?>> types = reflections.getTypesAnnotatedWith(annotation); Set<Method> methods = reflections.getMethodsAnnotatedWith(annotation); Set<Field> fields = reflections.getFieldsAnnotatedWith(annotation); List<DocAnnotationData> list = new ArrayList<>(); for (Class<?> type : types) { MustBeDocumented info = type.getDeclaredAnnotation(MustBeDocumented.class); if (info==null) { continue; } DocAnnotationData data = DocGeneratorUtil.buildDataForMustBeDocumented(info,type); data.linkedClass=type; list.add(data); } for (Method method : methods) { MustBeDocumented info = method.getDeclaredAnnotation(MustBeDocumented.class); if (info==null) { continue; } DocAnnotationData data = DocGeneratorUtil.buildDataForMustBeDocumented(info,method); data.linkedMethod=method; list.add(data); } for (Field field : fields) { MustBeDocumented info = field.getDeclaredAnnotation(MustBeDocumented.class); if (info==null) { continue; } DocAnnotationData data = DocGeneratorUtil.buildDataForMustBeDocumented(info,field); data.linkedField=field; list.add(data); } return list; }
MustBeDocumentedDataCollector { public List<DocAnnotationData> collect() { Class<? extends Annotation> annotation = MustBeDocumented.class; Set<Class<?>> types = reflections.getTypesAnnotatedWith(annotation); Set<Method> methods = reflections.getMethodsAnnotatedWith(annotation); Set<Field> fields = reflections.getFieldsAnnotatedWith(annotation); List<DocAnnotationData> list = new ArrayList<>(); for (Class<?> type : types) { MustBeDocumented info = type.getDeclaredAnnotation(MustBeDocumented.class); if (info==null) { continue; } DocAnnotationData data = DocGeneratorUtil.buildDataForMustBeDocumented(info,type); data.linkedClass=type; list.add(data); } for (Method method : methods) { MustBeDocumented info = method.getDeclaredAnnotation(MustBeDocumented.class); if (info==null) { continue; } DocAnnotationData data = DocGeneratorUtil.buildDataForMustBeDocumented(info,method); data.linkedMethod=method; list.add(data); } for (Field field : fields) { MustBeDocumented info = field.getDeclaredAnnotation(MustBeDocumented.class); if (info==null) { continue; } DocAnnotationData data = DocGeneratorUtil.buildDataForMustBeDocumented(info,field); data.linkedField=field; list.add(data); } return list; } }
MustBeDocumentedDataCollector { public List<DocAnnotationData> collect() { Class<? extends Annotation> annotation = MustBeDocumented.class; Set<Class<?>> types = reflections.getTypesAnnotatedWith(annotation); Set<Method> methods = reflections.getMethodsAnnotatedWith(annotation); Set<Field> fields = reflections.getFieldsAnnotatedWith(annotation); List<DocAnnotationData> list = new ArrayList<>(); for (Class<?> type : types) { MustBeDocumented info = type.getDeclaredAnnotation(MustBeDocumented.class); if (info==null) { continue; } DocAnnotationData data = DocGeneratorUtil.buildDataForMustBeDocumented(info,type); data.linkedClass=type; list.add(data); } for (Method method : methods) { MustBeDocumented info = method.getDeclaredAnnotation(MustBeDocumented.class); if (info==null) { continue; } DocAnnotationData data = DocGeneratorUtil.buildDataForMustBeDocumented(info,method); data.linkedMethod=method; list.add(data); } for (Field field : fields) { MustBeDocumented info = field.getDeclaredAnnotation(MustBeDocumented.class); if (info==null) { continue; } DocAnnotationData data = DocGeneratorUtil.buildDataForMustBeDocumented(info,field); data.linkedField=field; list.add(data); } return list; } MustBeDocumentedDataCollector(Reflections reflections); }
MustBeDocumentedDataCollector { public List<DocAnnotationData> collect() { Class<? extends Annotation> annotation = MustBeDocumented.class; Set<Class<?>> types = reflections.getTypesAnnotatedWith(annotation); Set<Method> methods = reflections.getMethodsAnnotatedWith(annotation); Set<Field> fields = reflections.getFieldsAnnotatedWith(annotation); List<DocAnnotationData> list = new ArrayList<>(); for (Class<?> type : types) { MustBeDocumented info = type.getDeclaredAnnotation(MustBeDocumented.class); if (info==null) { continue; } DocAnnotationData data = DocGeneratorUtil.buildDataForMustBeDocumented(info,type); data.linkedClass=type; list.add(data); } for (Method method : methods) { MustBeDocumented info = method.getDeclaredAnnotation(MustBeDocumented.class); if (info==null) { continue; } DocAnnotationData data = DocGeneratorUtil.buildDataForMustBeDocumented(info,method); data.linkedMethod=method; list.add(data); } for (Field field : fields) { MustBeDocumented info = field.getDeclaredAnnotation(MustBeDocumented.class); if (info==null) { continue; } DocAnnotationData data = DocGeneratorUtil.buildDataForMustBeDocumented(info,field); data.linkedField=field; list.add(data); } return list; } MustBeDocumentedDataCollector(Reflections reflections); List<DocAnnotationData> collect(); }
MustBeDocumentedDataCollector { public List<DocAnnotationData> collect() { Class<? extends Annotation> annotation = MustBeDocumented.class; Set<Class<?>> types = reflections.getTypesAnnotatedWith(annotation); Set<Method> methods = reflections.getMethodsAnnotatedWith(annotation); Set<Field> fields = reflections.getFieldsAnnotatedWith(annotation); List<DocAnnotationData> list = new ArrayList<>(); for (Class<?> type : types) { MustBeDocumented info = type.getDeclaredAnnotation(MustBeDocumented.class); if (info==null) { continue; } DocAnnotationData data = DocGeneratorUtil.buildDataForMustBeDocumented(info,type); data.linkedClass=type; list.add(data); } for (Method method : methods) { MustBeDocumented info = method.getDeclaredAnnotation(MustBeDocumented.class); if (info==null) { continue; } DocAnnotationData data = DocGeneratorUtil.buildDataForMustBeDocumented(info,method); data.linkedMethod=method; list.add(data); } for (Field field : fields) { MustBeDocumented info = field.getDeclaredAnnotation(MustBeDocumented.class); if (info==null) { continue; } DocAnnotationData data = DocGeneratorUtil.buildDataForMustBeDocumented(info,field); data.linkedField=field; list.add(data); } return list; } MustBeDocumentedDataCollector(Reflections reflections); List<DocAnnotationData> collect();  }