/** * Build the comments for the method. Do nothing if {@link Configuration#nocomment} is set to * true. * * @param node the XML element that specifies which components to document * @param methodDocTree the content tree to which the documentation will be added */ public void buildMethodComments(XMLNode node, Content methodDocTree) { if (!configuration.nocomment) { ExecutableElement method = currentMethod; if (utils.getBody(currentMethod).isEmpty()) { DocFinder.Output docs = DocFinder.search(configuration, new DocFinder.Input(utils, currentMethod)); if (docs.inlineTags != null && !docs.inlineTags.isEmpty()) method = (ExecutableElement) docs.holder; } TypeMirror containingType = method.getEnclosingElement().asType(); writer.addComments(containingType, method, methodDocTree); } }
/** * Loop through each individual parameter, despite not having a corresponding param tag, try to * inherit it. */ private Content getInheritedTagletOutput( boolean isParameters, Element holder, TagletWriter writer, List<? extends Element> formalParameters, Set<String> alreadyDocumented) { Utils utils = writer.configuration().utils; Content result = writer.getOutputInstance(); if ((!alreadyDocumented.contains(null)) && utils.isExecutableElement(holder)) { for (int i = 0; i < formalParameters.size(); i++) { if (alreadyDocumented.contains(String.valueOf(i))) { continue; } // This parameter does not have any @param documentation. // Try to inherit it. Input input = new DocFinder.Input( writer.configuration().utils, holder, this, Integer.toString(i), !isParameters); DocFinder.Output inheritedDoc = DocFinder.search(writer.configuration(), input); if (inheritedDoc.inlineTags != null && !inheritedDoc.inlineTags.isEmpty()) { Element e = formalParameters.get(i); String lname = isParameters ? utils.getSimpleName(e) : utils.getTypeName(e.asType(), false); CommentHelper ch = utils.getCommentHelper(holder); ch.setOverrideElement(inheritedDoc.holder); Content content = processParamTag( holder, isParameters, writer, inheritedDoc.holderTag, lname, alreadyDocumented.isEmpty()); result.addContent(content); } alreadyDocumented.add(String.valueOf(i)); } } return result; }