コード例 #1
0
 /** {@inheritDoc} */
 public Content getSignature(ConstructorDoc constructor) {
   Content pre = new HtmlTree(HtmlTag.PRE);
   writer.addAnnotationInfo(constructor, pre);
   addModifiers(constructor, pre);
   if (configuration.linksource) {
     Content constructorName = new StringContent(constructor.name());
     writer.addSrcLink(constructor, constructorName, pre);
   } else {
     addName(constructor.name(), pre);
   }
   int indent = pre.charCount();
   addParameters(constructor, pre, indent);
   addExceptions(constructor, pre, indent);
   return pre;
 }
コード例 #2
0
  /**
   * Parses a constructor type definition
   *
   * @param docConstructor
   * @return
   */
  protected static Constructor ParseConstructor(ConstructorDoc docConstructor) {
    assert (docConstructor != null);

    Constructor xmlConstructor = new Constructor();

    xmlConstructor.name = docConstructor.name();
    xmlConstructor.comment = docConstructor.commentText();
    xmlConstructor.scope = DetermineScope(docConstructor);
    xmlConstructor.isVarArgs = docConstructor.isVarArgs();
    xmlConstructor.isDefault =
        docConstructor.position().line() == docConstructor.containingClass().position().line();

    Parameter[] parameters = docConstructor.parameters();

    if (parameters != null && parameters.length > 0) {
      ParamTag[] paramComments = docConstructor.paramTags();

      ArrayList<Param> methodList = new ArrayList<Param>();

      for (Parameter parameter : parameters) {
        ParamTag paramComment = null;

        // look to see if this parameter has comments
        // if so, paramComment will be set
        for (ParamTag testParam : paramComments) {
          String testParamName = testParam.parameterName();
          if (testParamName != null) {
            if (testParamName.compareTo(parameter.name()) == 0) {
              paramComment = testParam;
              break;
            }
          }
        }

        methodList.add(ParseParameter(parameter, paramComment));
      }

      xmlConstructor.parameters = methodList.toArray(new Param[] {});
    } else {
      log.debug("No parameters for method: " + docConstructor.name());
    }

    // parse annotations for the constructor
    xmlConstructor.annotationInstances =
        ParseAnnotationInstances(docConstructor.annotations(), docConstructor.qualifiedName());

    return xmlConstructor;
  }
コード例 #3
0
 /** {@inheritDoc} */
 public Content getConstructorDocTreeHeader(
     ConstructorDoc constructor, Content constructorDetailsTree) {
   String erasureAnchor;
   if ((erasureAnchor = getErasureAnchor(constructor)) != null) {
     constructorDetailsTree.addContent(writer.getMarkerAnchor((erasureAnchor)));
   }
   constructorDetailsTree.addContent(writer.getMarkerAnchor(writer.getAnchor(constructor)));
   Content constructorDocTree = writer.getMemberTreeHeader();
   Content heading = new HtmlTree(HtmlConstants.MEMBER_HEADING);
   heading.addContent(constructor.name());
   constructorDocTree.addContent(heading);
   return constructorDocTree;
 }