本文整理汇总了Java中com.sun.javadoc.Parameter类的典型用法代码示例。如果您正苦于以下问题:Java Parameter类的具体用法?Java Parameter怎么用?Java Parameter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Parameter类属于com.sun.javadoc包,在下文中一共展示了Parameter类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: computeOperationString
import com.sun.javadoc.Parameter; //导入依赖的package包/类
/**
* Computes the string representation of this method
* appropriate for the construction of a
* java.rmi.server.Operation object.
**/
private String computeOperationString() {
/*
* To be consistent with previous implementations, we use
* the deprecated style of placing the "[]" for the return
* type (if any) after the parameter list.
*/
Type returnType = methodDoc.returnType();
String op = returnType.qualifiedTypeName() + " " +
methodDoc.name() + "(";
Parameter[] parameters = methodDoc.parameters();
for (int i = 0; i < parameters.length; i++) {
if (i > 0) {
op += ", ";
}
op += parameters[i].type().toString();
}
op += ")" + returnType.dimension();
return op;
}
示例2: linkedName
import com.sun.javadoc.Parameter; //导入依赖的package包/类
/**
* Appends to the current document a link that is
* built from the given ``element``. Such links is
* usually leading to the internal corresponding
* document section
*
* @param element Element to build link from.
*/
public void linkedName(final ProgramElementDoc element) {
final StringBuffer anchorBuilder = new StringBuffer()
.append('#')
.append(element.name());
if (element instanceof ExecutableMemberDoc) {
final ExecutableMemberDoc member = (ExecutableMemberDoc) element;
final Parameter[] parameters = member.parameters();
if (parameters.length == 0) { // Empty constructor case.
}
for (int i = 0; i < parameters.length; i++) {
anchorBuilder.append(parameters[i].type().simpleTypeName());
if (i < parameters.length - 1) {
anchorBuilder.append('-');
}
}
}
final String url = anchorBuilder.toString().toLowerCase();
link(element.name(), url);
}
示例3: start
import com.sun.javadoc.Parameter; //导入依赖的package包/类
public static boolean start(RootDoc root) {
ClassDoc[] classes = root.classes();
for (int i = 0; i < classes.length; i++) {
System.out.println(classes[i]);
ClassDoc classdoc = classes[i];
String x = classdoc.getRawCommentText();
System.out.println(x);
MethodDoc[] methods = classes[i].methods();
for (int j = 0; j < methods.length; j++) {
MethodDoc m = methods[j];
System.out.println(m.getRawCommentText());
if (m.isPublic()) {
System.out.println("\t" + m.name());
Parameter[] parameters = m.parameters();
for (int k = 0; k < parameters.length; k++) {
Parameter p = parameters[k];
System.out.println("\t\t" + p.name() + ": " + p.type().qualifiedTypeName());
}
}
}
}
return true;
}
示例4: write
import com.sun.javadoc.Parameter; //导入依赖的package包/类
/**
*
* {@inheritDoc}
*/
public void write(List<Handler> handlers,
Map<String, String> serializers) throws Exception {
FileWriter fstream = new FileWriter(LIST_OUT);
BufferedWriter out = new BufferedWriter(fstream);
for (Handler handler : handlers) {
for (ApiCall call : handler.getCalls()) {
out.write(handler.getName() + "." + call.getName() + " " +
call.getMethod().parameters().length + " ");
for (Parameter param : call.getMethod().parameters()) {
out.write(param.type().typeName() + " ");
}
out.write("\n");
}
}
out.close();
}
示例5: processParams
import com.sun.javadoc.Parameter; //导入依赖的package包/类
private String processParams(Parameter[] params)
{
String str = "";
for (int i = 0; i != params.length; i++)
{
if (str.length() > 1)
{
str += ", ";
}
if ((params[i].type().asParameterizedType() != null || params[i].type().asTypeVariable() != null))
{
str += handleGenerics(params[i].type(), 0);
} else if (params[i].type().asClassDoc() != null)
{
str += getTypeLink(params[i].type().asClassDoc());
} else
{
str += "<font class='type'>" + params[i].typeName() + "</font>";
}
str += " " + params[i].name();
}
return str;
}
示例6: toParameterNode
import com.sun.javadoc.Parameter; //导入依赖的package包/类
/**
* Returns the XML for a parameter and its corresponding param tag.
*
* @return The corresponding XML.
*/
private static XMLNode toParameterNode(Parameter parameter, ParamTag tag, boolean isVarArgs) {
if (parameter == null) return null;
XMLNode node = new XMLNode("parameter");
node.attribute("name", parameter.name());
node.attribute("type", parameter.type().typeName());
node.attribute("fulltype", parameter.type().toString());
String dimension = parameter.type().dimension();
if (isVarArgs) {
dimension = dimension.replaceAll("\\[\\]$", "") + "...";
}
node.attribute("dimension", dimension);
node.attribute("varargs", isVarArgs);
if (tag!= null) {
node.text(toComment(tag));
}
return node;
}
示例7: extractQueryParams
import com.sun.javadoc.Parameter; //导入依赖的package包/类
private void extractQueryParams(MethodDoc method, RestMethod restMethod)
{
Parameter[] params = method.parameters();
for (Parameter param : params)
{
AnnotationDesc queryParamAnnotation = getAnnotation(param.annotations(), "QueryParam");
if (queryParamAnnotation != null)
{
RestDocItem di = new RestDocItem();
di.setName(stripQuotes(queryParamAnnotation.elementValues()[0].value().toString()));
di.setComment(getParamComment(method.paramTags(), param.name()));
restMethod.getQueryParams().add(di);
}
}
}
示例8: extractPathParams
import com.sun.javadoc.Parameter; //导入依赖的package包/类
private void extractPathParams(MethodDoc method, RestMethod restMethod)
{
Parameter[] params = method.parameters();
for (Parameter param : params)
{
AnnotationDesc queryParamAnnotation = getAnnotation(param.annotations(), "PathParam");
if (queryParamAnnotation != null)
{
RestDocItem di = new RestDocItem();
di.setName(stripQuotes(queryParamAnnotation.elementValues()[0].value().toString()));
di.setComment(getParamComment(method.paramTags(), param.name()));
restMethod.getPathParams().add(di);
}
}
}
示例9: PSOperatorDoc
import com.sun.javadoc.Parameter; //导入依赖的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;
}
示例10: methodDescriptorOf
import com.sun.javadoc.Parameter; //导入依赖的package包/类
/**
* Returns the method descriptor for the specified method.
*
* See section 4.3.3 of The Java Virtual Machine Specification
* Second Edition for the definition of a "method descriptor".
**/
static String methodDescriptorOf(MethodDoc method) {
String desc = "(";
Parameter[] parameters = method.parameters();
for (int i = 0; i < parameters.length; i++) {
desc += typeDescriptorOf(parameters[i].type());
}
desc += ")" + typeDescriptorOf(method.returnType());
return desc;
}
示例11: getFriendlyUnqualifiedSignature
import com.sun.javadoc.Parameter; //导入依赖的package包/类
/**
* Returns a reader-friendly string representation of the
* specified method's signature. Names of reference types are not
* package-qualified.
**/
static String getFriendlyUnqualifiedSignature(MethodDoc method) {
String sig = method.name() + "(";
Parameter[] parameters = method.parameters();
for (int i = 0; i < parameters.length; i++) {
if (i > 0) {
sig += ", ";
}
Type paramType = parameters[i].type();
sig += paramType.typeName() + paramType.dimension();
}
sig += ")";
return sig;
}
示例12: parameterTypes
import com.sun.javadoc.Parameter; //导入依赖的package包/类
/**
* Returns the parameter types declared by this method.
**/
Type[] parameterTypes() {
Parameter[] parameters = methodDoc.parameters();
Type[] paramTypes = new Type[parameters.length];
for (int i = 0; i < paramTypes.length; i++) {
paramTypes[i] = parameters[i].type();
}
return paramTypes;
}
示例13: paramTypes
import com.sun.javadoc.Parameter; //导入依赖的package包/类
/**
* 获取指定方法的所有入参类型,便于反射
*
* @param methodDoc
* @return
* @throws ClassNotFoundException
*/
private static Class[] paramTypes(MethodDoc methodDoc) throws ClassNotFoundException {
Parameter[] parameters = methodDoc.parameters();
Class[] types = new Class[parameters.length];
for (int i = 0; i < parameters.length; i++) {
String className = parameters[i].type().qualifiedTypeName();
types[i] = ClassUtils.toBae(className);
if (types[i] == null) {
types[i] = Class.forName(className);
}
}
return types;
}