Пример #1
0
  /**
   * Parse type variables for generics
   *
   * @param variables
   * @return
   */
  protected static TypeVar[] ParseTypeVariables(TypeVariable[] variables, ParamTag[] tags) {
    TypeVar[] vars = null;

    if (variables != null && variables.length > 0) {
      ArrayList<TypeVar> varsList = new ArrayList<TypeVar>();

      for (TypeVariable variable : variables) {
        TypeVar var = new TypeVar();
        var.name = variable.typeName();
        Type[] bounds = variable.bounds();
        if (bounds != null && bounds.length > 0) {
          ArrayList<String> list = new ArrayList<String>();

          for (Type bound : bounds) {
            list.add(bound.qualifiedTypeName());
          }

          var.bounds = list.toArray(new String[] {});
        }
        for (ParamTag tag : tags)
          if (tag.parameterName().equals(var.name)) var.comment = tag.parameterComment();

        varsList.add(var);
      }

      vars = varsList.toArray(new TypeVar[] {});
    }

    return vars;
  }
Пример #2
0
  /**
   * Parses a method parameter type definition
   *
   * @param docParameter
   * @param paramComment
   * @return
   */
  protected static Param ParseParameter(Parameter docParameter, ParamTag paramComment) {
    assert (docParameter != null);

    Param xmlParameter = new Param();
    xmlParameter.name = docParameter.name();

    xmlParameter.type = ParseType(docParameter.type());

    if (paramComment != null) {
      xmlParameter.comment = paramComment.parameterComment();
    }

    xmlParameter.annotationInstances =
        ParseAnnotationInstances(docParameter.annotations(), docParameter.typeName());
    return xmlParameter;
  }