@Override public List<? extends Annotation<O>> getAnnotations() { List<Annotation<O>> annotations = new ArrayList<Annotation<O>>(); FieldSource<O> field = getField(); if (field != null) { List<AnnotationSource<O>> fieldAnnotations = field.getAnnotations(); annotations.addAll(fieldAnnotations); } MethodSource<O> accessor = getAccessor(); if (accessor != null) { List<AnnotationSource<O>> accessorAnnotations = accessor.getAnnotations(); annotations.addAll(accessorAnnotations); } MethodSource<O> mutator = getMutator(); if (mutator != null) { List<AnnotationSource<O>> mutatorAnnotations = mutator.getAnnotations(); annotations.addAll(mutatorAnnotations); } return annotations; }
@Override public List<? extends Annotation<O>> getAnnotations() { List<Annotation<O>> annotations = new ArrayList<Annotation<O>>(); FieldSource<O> field = getField(); if (field != null) { List<AnnotationSource<O>> fieldAnnotations = field.getAnnotations(); annotations.addAll(fieldAnnotations); } MethodSource<O> accessor = getAccessor(); if (accessor != null) { List<AnnotationSource<O>> accessorAnnotations = accessor.getAnnotations(); annotations.addAll(accessorAnnotations); } MethodSource<O> mutator = getMutator(); if (mutator != null) { List<AnnotationSource<O>> mutatorAnnotations = mutator.getAnnotations(); annotations.addAll(mutatorAnnotations); } return annotations; }
if (constructor.getAnnotations() != null && constructor.getAnnotations().size() > 0) { return false; //we never add annotations to constructors
public void visit(MethodSource<? extends JavaClassSource> methodSource) { for (ParameterSource<? extends JavaClassSource> paramSource : methodSource.getParameters()) { // Method parameters addJavaResourceReference(paramSource.getType().getQualifiedName()); // Method parameter annotations for (AnnotationSource<? extends JavaClassSource> annoSource : paramSource.getAnnotations()) { visit(annoSource); } } Type<? extends JavaClassSource> returnType = methodSource.getReturnType(); if (returnType != null) { String returnTypeQualifiedName = returnType.getQualifiedName(); if (!returnTypeQualifiedName.endsWith(".void")) { addJavaResourceReference(returnTypeQualifiedName); } } // method annotations for (AnnotationSource<? extends JavaClassSource> annoSource : methodSource.getAnnotations()) { visit(annoSource); } }