當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。