当前位置: 首页>>代码示例>>Java>>正文


Java MethodDoc.tags方法代码示例

本文整理汇总了Java中com.sun.javadoc.MethodDoc.tags方法的典型用法代码示例。如果您正苦于以下问题:Java MethodDoc.tags方法的具体用法?Java MethodDoc.tags怎么用?Java MethodDoc.tags使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.sun.javadoc.MethodDoc的用法示例。


在下文中一共展示了MethodDoc.tags方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getOutputParam

import com.sun.javadoc.MethodDoc; //导入方法依赖的package包/类
@Override
protected APIParameter getOutputParam(MethodDoc methodDoc) {
	APIParameter apiParameter = null;
	if (methodDoc.returnType() != null) {
		apiParameter = new APIParameter();
		apiParameter.setParameterOccurs(ParameterOccurs.REQUIRED);
		apiParameter.setType(this.getTypeName(methodDoc.returnType(), false));
		for (Tag tag : methodDoc.tags("return")) {
			apiParameter.setDescription(tag.text());
		}
		HashSet<String> processingClasses = new HashSet<String>();
		apiParameter.setFields(this.getFields(methodDoc.returnType(),
				ParameterType.Response, processingClasses));
		apiParameter.setHistory(this.getModificationHistory(methodDoc
				.returnType()));
	}
	return apiParameter;
}
 
开发者ID:WinRoad-NET,项目名称:wrdocletbase,代码行数:19,代码来源:DubboDocBuilder.java

示例2: returnDoc

import com.sun.javadoc.MethodDoc; //导入方法依赖的package包/类
public static void returnDoc(ApiDoc apiDoc, ClassDoc classDoc, MethodDoc methodDoc) throws Exception {
   	
   	Method method = DocletUtil.getMethodByDoc(Class.forName(classDoc.qualifiedTypeName()), methodDoc);
   	
   	Type returnType = method.getGenericReturnType();
   	
	if (returnType.toString().equalsIgnoreCase("void")) {
		return;
	}

	ResultDoc resultDoc = new ResultDoc();
	Tag[] tags = methodDoc.tags("return");
	if (tags != null && tags.length == 1) {
		String[] returnTexts = tags[0].text().split("(e.g|eg|e.g.|example|exam|例如|如)(:|:)", 2);
		resultDoc.setDesc(returnTexts[0]);
		resultDoc.setExampleValue(returnTexts.length==2 ? returnTexts[1] : "");
		resultDoc.setName("");
		resultDoc.setType(methodDoc.returnType().typeName() + methodDoc.returnType().dimension());
	}
   	
	addRefType(classDoc, returnType, resultDoc);
	
	apiDoc.setResultDoc(resultDoc);
}
 
开发者ID:linkeer8802,项目名称:api-resolver,代码行数:25,代码来源:ApiDoclet.java

示例3: PSOperatorDoc

import com.sun.javadoc.MethodDoc; //导入方法依赖的package包/类
private PSOperatorDoc(ClassDoc classDoc, MethodDoc methodDoc) {
        this.declaringClassDoc = classDoc;
        this.methodDoc = methodDoc;
        this.description = methodDoc.commentText().replace('\n', ' ');
        this.paramDesc = "";

        Tag[] paramTags = methodDoc.tags("param");
        for (Tag paramTag : paramTags) {
            String paraStr = paramTag.text();
            String paraName = paraStr.substring(0, paraStr.indexOf(' ')).replace('\n', ' ');;
            String paraDesc = paraStr.substring(paraStr.indexOf(' ') + 1).replace('\n', ' ');;
            this.paramDesc += "<br> - `" + paraName + "`: " + paraDesc;
        }

        this.returnType = methodDoc.returnType();
//        ParameterizedType returnType = methodDoc.returnType().asParameterizedType();
//        this.inputType = returnType.typeArguments()[0];
//        this.outputType = returnType.typeArguments()[1];
//        this.completeSignature = "Function<" + this.inputType + ", " + this.outputType + "> " + methodDoc.toString();

        String shortSignature = classDoc.name() + "." + methodDoc.name() + "(";
        boolean firstParameter = true;
        for (Parameter parameter : methodDoc.parameters()) {
            if (firstParameter) {
                shortSignature += Utils.getSimpleTypeName(parameter.type()) + " " + parameter.name();
                firstParameter = false;
            } else {
                shortSignature += ", " + Utils.getSimpleTypeName(parameter.type()) + " " + parameter.name();
            }
        }
        shortSignature += ")";
        this.shortSignature = shortSignature;
    }
 
开发者ID:PrivacyStreams,项目名称:PrivacyStreams,代码行数:34,代码来源:PSOperatorDoc.java

示例4: parseCustomizedParameters

import com.sun.javadoc.MethodDoc; //导入方法依赖的package包/类
protected LinkedList<APIParameter> parseCustomizedParameters(MethodDoc methodDoc) {
	Tag[] tags = methodDoc.tags(WRParamTaglet.NAME);
	LinkedList<APIParameter> result = new LinkedList<APIParameter>();
	for (int i = 0; i < tags.length; i++) {
		result.add(WRParamTaglet.parse(tags[i].text()));
	}
	return result;
}
 
开发者ID:WinRoad-NET,项目名称:wrdocletbase,代码行数:9,代码来源:AbstractDocBuilder.java

示例5: parseCustomizedReturn

import com.sun.javadoc.MethodDoc; //导入方法依赖的package包/类
protected APIParameter parseCustomizedReturn(MethodDoc methodDoc) {
	Tag[] tags = methodDoc.tags(WRReturnTaglet.NAME);
	APIParameter result = null;
	if (tags.length > 0) {
		result = WRReturnTaglet.parse(tags[0].text());
	}
	return result;
}
 
开发者ID:WinRoad-NET,项目名称:wrdocletbase,代码行数:9,代码来源:AbstractDocBuilder.java

示例6: handleRefReq

import com.sun.javadoc.MethodDoc; //导入方法依赖的package包/类
protected void handleRefReq(MethodDoc method, List<APIParameter> paramList) {
	Tag[] tags = method.tags(WRRefReqTaglet.NAME);
	for (int i = 0; i < tags.length; i++) {
		APIParameter apiParameter = new APIParameter();
		String[] strArr = tags[i].text().split(" ");
		for (int j = 0; j < strArr.length; j++) {
			switch (j) {
			case 0:
				apiParameter.setName(strArr[j]);
				break;
			case 1:
				apiParameter.setType(strArr[j]);
				break;
			case 2:
				apiParameter.setDescription(strArr[j]);
				break;
			case 3:
				if (StringUtils.equalsIgnoreCase(strArr[j], WROccursTaglet.REQUIRED)) {
					apiParameter.setParameterOccurs(ParameterOccurs.REQUIRED);
				} else if (StringUtils.equalsIgnoreCase(strArr[j], WROccursTaglet.OPTIONAL)) {
					apiParameter.setParameterOccurs(ParameterOccurs.OPTIONAL);
				}
				break;
			default:
				logger.warn("Unexpected tag:" + tags[i].text());
			}
		}
		HashSet<String> processingClasses = new HashSet<String>();
		ClassDoc c = this.wrDoc.getConfiguration().root.classNamed(apiParameter.getType());
		if (c != null) {
			apiParameter.setFields(this.getFields(c, ParameterType.Request, processingClasses));
		}
		paramList.add(apiParameter);
	}
}
 
开发者ID:WinRoad-NET,项目名称:wrdocletbase,代码行数:36,代码来源:AbstractDocBuilder.java

示例7: getOutputParam

import com.sun.javadoc.MethodDoc; //导入方法依赖的package包/类
@Override
protected APIParameter getOutputParam(MethodDoc method) {
	APIParameter apiParameter = null;
	if (method.returnType() != null) {
		apiParameter = new APIParameter();
		AnnotationDesc[] annotations = method.annotations();
		boolean isResNameCustomized = false;
		for (int i = 0; i < annotations.length; i++) {
			if (annotations[i].annotationType().name().equals("WebResult")) {
				for (ElementValuePair p : annotations[i].elementValues()) {
					if (p.element().name().equals("name")) {
						apiParameter.setName(p.value().value().toString());
						isResNameCustomized = true;
					}
				}
			}
		}
		if (!isResNameCustomized) {
			apiParameter.setName("return");
		}
		apiParameter.setParameterOccurs(ParameterOccurs.REQUIRED);
		apiParameter.setType(this.getTypeName(method.returnType(), false));
		for (Tag tag : method.tags("return")) {
			apiParameter.setDescription(tag.text());
		}
		HashSet<String> processingClasses = new HashSet<String>();
		apiParameter.setFields(this.getFields(method.returnType(),
				ParameterType.Response, processingClasses));
		apiParameter.setHistory(this.getModificationHistory(method
				.returnType()));
	}
	return apiParameter;
}
 
开发者ID:WinRoad-NET,项目名称:wrdocletbase,代码行数:34,代码来源:SOAPDocBuilder.java

示例8: toMethods

import com.sun.javadoc.MethodDoc; //导入方法依赖的package包/类
/**
 * Transforms an array of methods and an array of constructor methods into XML and adds those to the host node.
 *
 * @param methods The methods.
 * @param constructors The constructors.
 * @param node The node to add the XML to.
 */
private static XMLNode toMethods(MethodDoc[] methods) {
  if (methods.length < 1) return null;

  // Create the <methods> node
  XMLNode node = new XMLNode("methods");

  // Add the <method> nodes
  for (MethodDoc method : methods) {
    XMLNode methodNode = new XMLNode("method");

    updateExecutableMemberNode(method, methodNode);

    methodNode.attribute("type",     method.returnType().typeName());
    methodNode.attribute("fulltype", method.returnType().toString());
    methodNode.attribute("abstract", method.isAbstract());

    Tag[] returnTags = method.tags("@return");
    if (returnTags.length > 0) {
      node.text(toComment(returnTags[0]));
    }

    node.child(methodNode);
  }

  return node;
}
 
开发者ID:pageseeder,项目名称:xmldoclet,代码行数:34,代码来源:XMLDoclet.java

示例9: fromMethodDoc

import com.sun.javadoc.MethodDoc; //导入方法依赖的package包/类
public static MethodDocumentation fromMethodDoc(MethodDoc methodDoc) {
    MethodDocumentation md = new MethodDocumentation();
    md.comment = methodDoc.commentText();

    for (Tag tag : methodDoc.tags()) {
        if (tag instanceof ParamTag) {
            ParamTag paramTag = (ParamTag) tag;
            md.parameters.put(paramTag.parameterName(), paramTag.parameterComment());
        } else {
            md.tags.put(cleanupTagName(tag.name()), tag.text());
        }
    }

    return md;
}
 
开发者ID:ScaCap,项目名称:spring-auto-restdocs,代码行数:16,代码来源:MethodDocumentation.java

示例10: isTagSufficient

import com.sun.javadoc.MethodDoc; //导入方法依赖的package包/类
/** Checks if the comment at a tag is sufficient. */
private boolean isTagSufficient(MethodDoc docElement, String tagName) {
	Tag[] tags = docElement.tags(tagName);
	if (tags.length == 0) {
		return false;
	}
	for (Tag tag : tags) {
		if (!isInsufficient(tag.text())) {
			return true;
		}
	}
	return false;
}
 
开发者ID:vimaier,项目名称:conqat,代码行数:14,代码来源:InsufficientCommentAnalyzer.java

示例11: isSeeTagSufficient

import com.sun.javadoc.MethodDoc; //导入方法依赖的package包/类
/**
 * Checks if the <code>see</code> tag is sufficient. As this usually
 * contains only a class name, we cannot use the
 * {@link #isInsufficient(String)} here.
 */
private boolean isSeeTagSufficient(MethodDoc docElement) {
	Tag[] tags = docElement.tags("see");
	if (tags.length == 0) {
		return false;
	}
	for (Tag tag : tags) {
		if (tag.text().length() > 2) {
			return true;
		}
	}
	return false;
}
 
开发者ID:vimaier,项目名称:conqat,代码行数:18,代码来源:InsufficientCommentAnalyzer.java

示例12: fromMethodDoc

import com.sun.javadoc.MethodDoc; //导入方法依赖的package包/类
static AttributeData fromMethodDoc(MethodDoc methodDoc) {
        AttributeData data = new AttributeData();
        data.description = methodDoc.commentText();
        data.required = !(methodDoc.tags(TAG_ANTDOC_NOTREQUIRED).length > 0);
        data.name = sanitizeName(methodDoc.name(), ATTRIBUTE_PREFIXES);

        return data;
}
 
开发者ID:rimerosolutions,项目名称:ant-git-tasks,代码行数:9,代码来源:AntTaskDoclet.java

示例13: getReturnTypeComment

import com.sun.javadoc.MethodDoc; //导入方法依赖的package包/类
private String getReturnTypeComment(MethodDoc method)
{
  Tag[] returnTags = method.tags("return");

  if (returnTags.length > 0)
  {
    return returnTags[0].text();
  }

  return null;

}
 
开发者ID:rabidgremlin,项目名称:JerseyDoc,代码行数:13,代码来源:DocGenerator.java

示例14: extractAuditNotes

import com.sun.javadoc.MethodDoc; //导入方法依赖的package包/类
private void extractAuditNotes(MethodDoc method, RestMethod restMethod)
{
  Tag[] auditNoteTags = method.tags("audit.note");

  if (auditNoteTags.length > 0)
  {
    for (Tag tag : auditNoteTags)
    {
      LOGGER.fine("TAGS: " + tag);

      String[] parts = tag.text().split(" ", 2);

      if (parts.length != 2)
      {
        LOGGER.info(method.qualifiedName() + " has malformed audit.note tag: " + tag.toString());
        continue;
      }

      LOGGER.fine("PARTS: " + parts[0] + " - " + parts[1]);

      RestMethodAuditNote an = new RestMethodAuditNote();
      an.setNoteId(parts[0]);
      an.setNote(parts[1]);

      restMethod.getRestMethodAuditNotes().add(an);
    }

    LOGGER.fine("Added " + restMethod.getRestMethodAuditNotes().size() + " audit notes..");
  }

}
 
开发者ID:rabidgremlin,项目名称:JerseyDoc,代码行数:32,代码来源:DocGenerator.java

示例15: buildOpenAPIs

import com.sun.javadoc.MethodDoc; //导入方法依赖的package包/类
protected void buildOpenAPIs(Configuration configuration) {
	Set<Entry<String, Set<MethodDoc>>> methods = this.taggedOpenAPIMethods.entrySet();
	for (Iterator<Entry<String, Set<MethodDoc>>> tagMthIter = methods.iterator(); tagMthIter.hasNext();) {
		Entry<String, Set<MethodDoc>> kv = tagMthIter.next();
		String tagName = kv.getKey();
		if (!this.wrDoc.getTaggedOpenAPIs().containsKey(tagName)) {
			this.wrDoc.getTaggedOpenAPIs().put(tagName, new LinkedList<OpenAPI>());
		}
		Set<MethodDoc> methodDocSet = kv.getValue();
		for (Iterator<MethodDoc> mthIter = methodDocSet.iterator(); mthIter.hasNext();) {
			MethodDoc methodDoc = mthIter.next();
			OpenAPI openAPI = new OpenAPI();
			openAPI.setDeprecated(Util.isDeprecated(methodDoc) || Util.isDeprecated(methodDoc.containingClass())
					|| Util.isDeprecated(methodDoc.containingPackage()));
			Tag[] tags = this.getTagTaglets(methodDoc);
			if (tags.length == 0 && this.methodMap.containsKey(methodDoc)) {
				tags = this.getTagTaglets(this.methodMap.get(methodDoc));
			}
			if (tags.length == 0) {
				openAPI.addTag(methodDoc.containingClass().simpleTypeName());
			} else {
				for (Tag t : tags) {
					openAPI.addTags(WRTagTaglet.getTagSet(t.text()));
				}
			}
			openAPI.setQualifiedName(methodDoc.qualifiedName());
			if (StringUtils.isNotBlank(methodDoc.commentText())) {
				openAPI.setDescription(methodDoc.commentText());
			} else if (this.methodMap.containsKey(methodDoc)) {
				openAPI.setDescription(this.methodMap.get(methodDoc).commentText());
			}

			String brief;
			if (methodDoc.tags(WRBriefTaglet.NAME).length == 0) {
				brief = getBriefFromCommentText(methodDoc.commentText());
			} else {
				brief = methodDoc.tags(WRBriefTaglet.NAME)[0].text();
			}
			if (StringUtils.isBlank(brief) && this.methodMap.containsKey(methodDoc)) {
				if (this.methodMap.get(methodDoc).tags(WRBriefTaglet.NAME).length == 0) {
					brief = getBriefFromCommentText(this.methodMap.get(methodDoc).commentText());
				} else {
					brief = this.methodMap.get(methodDoc).tags(WRBriefTaglet.NAME)[0].text();
				}
			}
			openAPI.setBrief(brief);
			if (StringUtils.isBlank(openAPI.getDescription())) {
				openAPI.setDescription(openAPI.getBrief());
			}

			openAPI.setModificationHistory(this.getModificationHistory(methodDoc));
			openAPI.setRequestMapping(this.parseRequestMapping(methodDoc));
			if (openAPI.getRequestMapping() != null) {
				openAPI.setAuthNeeded(this.isAPIAuthNeeded(openAPI.getRequestMapping().getUrl()));
			}
			openAPI.addInParameters(this.getInputParams(methodDoc));
			openAPI.setOutParameter(this.getOutputParam(methodDoc));
			openAPI.setReturnCode(this.getReturnCode(methodDoc));
			this.wrDoc.getTaggedOpenAPIs().get(tagName).add(openAPI);
		}
	}
}
 
开发者ID:WinRoad-NET,项目名称:wrdocletbase,代码行数:63,代码来源:AbstractDocBuilder.java


注:本文中的com.sun.javadoc.MethodDoc.tags方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。