/** Copy the doc files for the current ClassDoc if necessary. */
 private void copyDocFiles() {
   PackageDoc containingPackage = annotationTypeDoc.containingPackage();
   if ((configuration.packages == null
           || Arrays.binarySearch(configuration.packages, containingPackage) < 0)
       && !containingPackagesSeen.contains(containingPackage.name())) {
     // Only copy doc files dir if the containing package is not
     // documented AND if we have not documented a class from the same
     // package already. Otherwise, we are making duplicate copies.
     Util.copyDocFiles(
         configuration,
         Util.getPackageSourcePath(configuration, annotationTypeDoc.containingPackage())
             + DirectoryManager.getDirectoryPath(annotationTypeDoc.containingPackage())
             + File.separator,
         DocletConstants.DOC_FILES_DIR_NAME,
         true);
     containingPackagesSeen.add(containingPackage.name());
   }
 }
示例#2
0
 /**
  * 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;
 }
 /**
  * Build the annotation type documentation.
  *
  * @param node the XML element that specifies which components to document
  * @param contentTree the content tree to which the documentation will be added
  */
 public void buildAnnotationTypeDoc(XMLNode node, Content contentTree) throws Exception {
   contentTree =
       writer.getHeader(
           configuration.getText("doclet.AnnotationType") + " " + annotationTypeDoc.name());
   Content annotationContentTree = writer.getAnnotationContentHeader();
   buildChildren(node, annotationContentTree);
   contentTree.addContent(annotationContentTree);
   writer.addFooter(contentTree);
   writer.printDocument(contentTree);
   writer.close();
   copyDocFiles();
 }
 /**
  * Build the signature of the current annotation type.
  *
  * @param node the XML element that specifies which components to document
  * @param annotationInfoTree the content tree to which the documentation will be added
  */
 public void buildAnnotationTypeSignature(XMLNode node, Content annotationInfoTree) {
   StringBuffer modifiers = new StringBuffer(annotationTypeDoc.modifiers() + " ");
   writer.addAnnotationTypeSignature(
       Util.replaceText(modifiers.toString(), "interface", "@interface"), annotationInfoTree);
 }