for (final AnnotationDesc annotationDesc : annotations) { final AnnotationDocType annotationDocType = new AnnotationDocType(); final String typeName = annotationDesc.annotationType().qualifiedName(); annotationDocType.setAnnotationTypeName(typeName); for (final ElementValuePair elementValuePair : annotationDesc.elementValues()) {
private static AnnotationDesc getAnnotation(ProgramElementDoc doc, String qualifiedName) { for (AnnotationDesc annotation : doc.annotations()) { if (annotation.annotationType().qualifiedName().equals(qualifiedName)) { return annotation; } } return null; }
private static AnnotationDesc getAnnotation(ProgramElementDoc doc, String qualifiedName) { for (AnnotationDesc annotation : doc.annotations()) { if (annotation.annotationType().qualifiedName().equals(qualifiedName)) { return annotation; } } return null; }
private static AnnotationDesc getAnnotation(ProgramElementDoc doc, String qualifiedName) { for (AnnotationDesc annotation : doc.annotations()) { if (annotation.annotationType().qualifiedName().equals(qualifiedName)) { return annotation; } } return null; }
/** * Given an annotation, return true if it should be documented and false * otherwise. * * @param annotationDoc the annotation to check. * * @return true return true if it should be documented and false otherwise. */ public static boolean isDocumentedAnnotation(AnnotationTypeDoc annotationDoc) { AnnotationDesc[] annotationDescList = annotationDoc.annotations(); for (int i = 0; i < annotationDescList.length; i++) { if (annotationDescList[i].annotationType().qualifiedName().equals( java.lang.annotation.Documented.class.getName())){ return true; } } return false; }
private static Optional<String> summaryFromAnnotation(MethodDoc methodDoc) { return Stream.of(methodDoc.annotations()) .filter(annotation -> io.swagger.v3.oas.annotations.Operation.class.getName().equals(annotation.annotationType().qualifiedName())) .findFirst() .flatMap(a -> Stream.of(a.elementValues()) .filter(elementValuePair -> "summary".equals(elementValuePair.element().name())) .map(elementValuePair -> elementValuePair.value().value().toString()) .findFirst()); }
/** * Given an annotation, return true if it should be documented and false * otherwise. * * @param annotationDoc the annotation to check. * * @return true return true if it should be documented and false otherwise. */ public static boolean isDocumentedAnnotation(AnnotationTypeDoc annotationDoc) { AnnotationDesc[] annotationDescList = annotationDoc.annotations(); for (int i = 0; i < annotationDescList.length; i++) { if (annotationDescList[i].annotationType().qualifiedName().equals( java.lang.annotation.Documented.class.getName())){ return true; } } return false; }
public boolean isFunctionalInterface(AnnotationDesc annotationDesc) { return annotationDesc.annotationType().qualifiedName().equals( env.syms.functionalInterfaceType.toString()) && env.source.allowLambda(); }
/** * Return true if the given Doc is deprecated. * * @param doc the Doc to check. * @return true if the given Doc is deprecated. */ public static boolean isDeprecated(ProgramElementDoc doc) { if (doc.tags("deprecated").length > 0) { return true; } AnnotationDesc[] annotationDescList = doc.annotations(); for (int i = 0; i < annotationDescList.length; i++) { if (annotationDescList[i].annotationType().qualifiedName().equals( java.lang.Deprecated.class.getName())){ return true; } } return false; } }
/** * Returns true if the {@code annotationDoc} is to be treated * as a declaration annotation, when targeting the * {@code elemType} element type. * * @param annotationDoc the annotationDoc to check * @param elemType the targeted elemType * @return true if annotationDoc is a declaration annotation */ public static boolean isDeclarationAnnotation(AnnotationTypeDoc annotationDoc, boolean isJava5DeclarationLocation) { if (!isJava5DeclarationLocation) return false; AnnotationDesc[] annotationDescList = annotationDoc.annotations(); // Annotations with no target are treated as declaration as well if (annotationDescList.length==0) return true; for (int i = 0; i < annotationDescList.length; i++) { if (annotationDescList[i].annotationType().qualifiedName().equals( java.lang.annotation.Target.class.getName())) { if (isDeclarationTarget(annotationDescList[i])) return true; } } return false; }
/** * Return true if the given Doc is deprecated. * * @param doc the Doc to check. * @return true if the given Doc is deprecated. */ public static boolean isDeprecated(Doc doc) { if (doc.tags("deprecated").length > 0) { return true; } AnnotationDesc[] annotationDescList; if (doc instanceof PackageDoc) annotationDescList = ((PackageDoc)doc).annotations(); else annotationDescList = ((ProgramElementDoc)doc).annotations(); for (int i = 0; i < annotationDescList.length; i++) { if (annotationDescList[i].annotationType().qualifiedName().equals( java.lang.Deprecated.class.getName())){ return true; } } return false; }
/** * Parse an annotation. * * @param annotationTypeDoc * A AnnotationTypeDoc instance * @return the annotation node */ protected Annotation parseAnnotationTypeDoc(AnnotationTypeDoc annotationTypeDoc) { Annotation annotationNode = objectFactory.createAnnotation(); annotationNode.setName(annotationTypeDoc.name()); annotationNode.setQualified(annotationTypeDoc.qualifiedName()); String comment = annotationTypeDoc.commentText(); if (comment.length() > 0) { annotationNode.setComment(comment); } annotationNode.setIncluded(annotationTypeDoc.isIncluded()); annotationNode.setScope(parseScope(annotationTypeDoc)); for (AnnotationTypeElementDoc annotationTypeElementDoc : annotationTypeDoc.elements()) { annotationNode.getElement().add(parseAnnotationTypeElementDoc(annotationTypeElementDoc)); } for (AnnotationDesc annotationDesc : annotationTypeDoc.annotations()) { annotationNode.getAnnotation().add(parseAnnotationDesc(annotationDesc, annotationTypeDoc.qualifiedName())); } for (Tag tag : annotationTypeDoc.tags()) { annotationNode.getTag().add(parseTag(tag)); } return annotationNode; }
for ( AnnotationDesc annotationDesc : annotations ) { final AnnotationDocType annotationDocType = new AnnotationDocType(); final String typeName = annotationDesc.annotationType().qualifiedName(); annotationDocType.setAnnotationTypeName( typeName ); for ( ElementValuePair elementValuePair : annotationDesc.elementValues() ) {
if (annotationDesc.annotationType().qualifiedName().startsWith("restx.annotations.")) { Optional<Object> value = getAnnotationParamValue(annotationDesc.elementValues(), "value");