/**
  * Construct a new MethodBuilder.
  *
  * @param context the build context.
  * @param typeElement the class whoses members are being documented.
  * @param writer the doclet specific writer.
  */
 private MethodBuilder(Context context, TypeElement typeElement, MethodWriter writer) {
   super(context);
   this.typeElement = typeElement;
   this.writer = writer;
   visibleMemberMap =
       new VisibleMemberMap(typeElement, VisibleMemberMap.Kind.METHODS, configuration);
   methods = visibleMemberMap.getLeafClassMembers();
 }
 /**
  * Build the method documentation.
  *
  * @param node the XML element that specifies which components to document
  * @param memberDetailsTree the content tree to which the documentation will be added
  */
 public void buildMethodDoc(XMLNode node, Content memberDetailsTree) {
   if (writer == null) {
     return;
   }
   if (!methods.isEmpty()) {
     Content methodDetailsTree = writer.getMethodDetailsTreeHeader(typeElement, memberDetailsTree);
     Set<Element> methodDetailSet =
         ((ConfigurationImpl) configuration).sortedMethodDetails
             ? methods
             : visibleMemberMap.getLeafClassMembersSourceOrder();
     for (Element e : methodDetailSet) {
       currentMethod = (ExecutableElement) e;
       Content methodDocTree = writer.getMethodDocTreeHeader(currentMethod, methodDetailsTree);
       buildChildren(node, methodDocTree);
       methodDetailsTree.addContent(
           writer.getMethodDoc(methodDocTree, currentMethod == methods.last()));
     }
     memberDetailsTree.addContent(writer.getMethodDetails(methodDetailsTree));
   }
 }
 /**
  * Returns a list of methods that will be documented for the given class. This information can be
  * used for doclet specific documentation generation.
  *
  * @param typeElement the {@link TypeElement} we want to check.
  * @return a list of methods that will be documented.
  */
 public SortedSet<Element> members(TypeElement typeElement) {
   return visibleMemberMap.getMembersFor(typeElement);
 }