/** * Generate the deprecated API list. * * @param deprapi list of deprecated API built already. */ protected void generateDeprecatedListFile(DeprecatedAPIListBuilder deprapi) throws IOException { Content body = getHeader(); body.addContent(getContentsList(deprapi)); String memberTableSummary; String[] memberTableHeader = new String[1]; HtmlTree div = new HtmlTree(HtmlTag.DIV); div.addStyle(HtmlStyle.contentContainer); for (int i = 0; i < DeprecatedAPIListBuilder.NUM_TYPES; i++) { if (deprapi.hasDocumentation(i)) { addAnchor(deprapi, i, div); memberTableSummary = configuration.getText( "doclet.Member_Table_Summary", configuration.getText(HEADING_KEYS[i]), configuration.getText(SUMMARY_KEYS[i])); memberTableHeader[0] = configuration.getText( "doclet.0_and_1", configuration.getText(HEADER_KEYS[i]), configuration.getText("doclet.Description")); writers[i].addDeprecatedAPI( deprapi.getList(i), HEADING_KEYS[i], memberTableSummary, memberTableHeader, div); } } body.addContent(div); addNavLinks(false, body); addBottom(body); printHtmlDocument(null, true, body); }
/** * Add the modifier for the member. * * @param member the member to add the type for * @param code the content tree to which the modified will be added */ private void addModifier(ProgramElementDoc member, Content code) { if (member.isProtected()) { code.addContent("protected "); } else if (member.isPrivate()) { code.addContent("private "); } else if (!member.isPublic()) { // Package private code.addContent(configuration.getText("doclet.Package_private")); code.addContent(" "); } if (member.isMethod()) { if (!(member.containingClass().isInterface()) && ((MethodDoc) member).isAbstract()) { code.addContent("abstract "); } // This check for isDefault() and the default modifier needs to be // added for it to appear on the "Modifier and Type" column in the // method summary section. Once the default modifier is added // to the Modifier list on DocEnv and once it is updated to use the // javax.lang.model.element.Modifier, we will need to remove this. if (((MethodDoc) member).isDefault()) { code.addContent("default "); } } if (member.isStatic()) { code.addContent("static "); } }
/** * Get the header for the deprecated API Listing. * * @return a content tree for the header */ public Content getHeader() { String title = configuration.getText("doclet.Window_Deprecated_List"); Content bodyTree = getBody(true, getWindowTitle(title)); addTop(bodyTree); addNavLinks(true, bodyTree); return bodyTree; }
/** * Write the output to the file. * * @param body the documentation content to be written to the file. * @param path the path for the file. */ private void writeToFile(Content body, DocPath path) throws IOException { Content htmlDocType = configuration.isOutputHtml5() ? DocType.HTML5 : DocType.TRANSITIONAL; Content head = new HtmlTree(HtmlTag.HEAD); head.addContent( HtmlTree.TITLE(new StringContent(configuration.getText("doclet.Window_Source_title")))); head.addContent(getStyleSheetProperties()); Content htmlTree = HtmlTree.HTML(configuration.getLocale().getLanguage(), head, body); Content htmlDocument = new HtmlDocument(htmlDocType, htmlTree); configuration.message.notice("doclet.Generating_0", path.getPath()); DocFile df = DocFile.createFileForOutput(configuration, path); try (Writer w = df.openWriter()) { htmlDocument.write(w, true); } }
/** * Constructor. * * @param filename the file to be generated. * @throws IOException * @throws DocletAbortException */ public ClassUseWriter( ConfigurationImpl configuration, ClassUseMapper mapper, DocPath filename, ClassDoc classdoc) throws IOException { super(configuration, filename); this.classdoc = classdoc; if (mapper.classToPackageAnnotations.containsKey(classdoc.qualifiedName())) pkgToPackageAnnotations = new TreeSet<>(mapper.classToPackageAnnotations.get(classdoc.qualifiedName())); configuration.currentcd = classdoc; this.pkgSet = new TreeSet<>(); this.pkgToClassTypeParameter = pkgDivide(mapper.classToClassTypeParam); this.pkgToClassAnnotations = pkgDivide(mapper.classToClassAnnotations); this.pkgToMethodTypeParameter = pkgDivide(mapper.classToExecMemberDocTypeParam); this.pkgToMethodArgTypeParameter = pkgDivide(mapper.classToExecMemberDocArgTypeParam); this.pkgToFieldTypeParameter = pkgDivide(mapper.classToFieldDocTypeParam); this.pkgToFieldAnnotations = pkgDivide(mapper.annotationToFieldDoc); this.pkgToMethodReturnTypeParameter = pkgDivide(mapper.classToExecMemberDocReturnTypeParam); this.pkgToMethodAnnotations = pkgDivide(mapper.classToExecMemberDocAnnotations); this.pkgToMethodParameterAnnotations = pkgDivide(mapper.classToExecMemberDocParamAnnotation); this.pkgToSubclass = pkgDivide(mapper.classToSubclass); this.pkgToSubinterface = pkgDivide(mapper.classToSubinterface); this.pkgToImplementingClass = pkgDivide(mapper.classToImplementingClass); this.pkgToField = pkgDivide(mapper.classToField); this.pkgToMethodReturn = pkgDivide(mapper.classToMethodReturn); this.pkgToMethodArgs = pkgDivide(mapper.classToMethodArgs); this.pkgToMethodThrows = pkgDivide(mapper.classToMethodThrows); this.pkgToConstructorAnnotations = pkgDivide(mapper.classToConstructorAnnotations); this.pkgToConstructorParameterAnnotations = pkgDivide(mapper.classToConstructorParamAnnotation); this.pkgToConstructorArgs = pkgDivide(mapper.classToConstructorArgs); this.pkgToConstructorArgTypeParameter = pkgDivide(mapper.classToConstructorDocArgTypeParam); this.pkgToConstructorThrows = pkgDivide(mapper.classToConstructorThrows); // tmp test if (pkgSet.size() > 0 && mapper.classToPackage.containsKey(classdoc.qualifiedName()) && !pkgSet.equals(mapper.classToPackage.get(classdoc.qualifiedName()))) { configuration.root.printWarning( "Internal error: package sets don't match: " + pkgSet + " with: " + mapper.classToPackage.get(classdoc.qualifiedName())); } methodSubWriter = new MethodWriterImpl(this); constrSubWriter = new ConstructorWriterImpl(this); fieldSubWriter = new FieldWriterImpl(this); classSubWriter = new NestedClassWriterImpl(this); classUseTableSummary = configuration.getText("doclet.Use_Table_Summary", configuration.getText("doclet.classes")); subclassUseTableSummary = configuration.getText( "doclet.Use_Table_Summary", configuration.getText("doclet.subclasses")); subinterfaceUseTableSummary = configuration.getText( "doclet.Use_Table_Summary", configuration.getText("doclet.subinterfaces")); fieldUseTableSummary = configuration.getText("doclet.Use_Table_Summary", configuration.getText("doclet.fields")); methodUseTableSummary = configuration.getText("doclet.Use_Table_Summary", configuration.getText("doclet.methods")); constructorUseTableSummary = configuration.getText( "doclet.Use_Table_Summary", configuration.getText("doclet.constructors")); }