Java Code Examples for com.sun.javadoc.MethodDoc#parameters()

The following examples show how to use com.sun.javadoc.MethodDoc#parameters() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DumpJavaDoc.java    From cxf with Apache License 2.0 5 votes vote down vote up
public static boolean start(RootDoc root) throws IOException {
    String dumpFileName = readOptions(root.options());
    OutputStream os = Files.newOutputStream(Paths.get(dumpFileName));
    Properties javaDocMap = new Properties();
    for (ClassDoc classDoc : root.classes()) {
        javaDocMap.put(classDoc.toString(), classDoc.commentText());
        for (MethodDoc method : classDoc.methods()) {
            javaDocMap.put(method.qualifiedName(), method.commentText());
            for (ParamTag paramTag : method.paramTags()) {
                Parameter[] parameters = method.parameters();
                for (int i = 0; i < parameters.length; ++i) {
                    if (parameters[i].name().equals(paramTag.parameterName())) {
                        javaDocMap.put(method.qualifiedName() + ".paramCommentTag." + i,
                               paramTag.parameterComment());
                    }
                }
            }
            Tag[] retTags = method.tags("return");
            if (retTags != null && retTags.length == 1) {
                Tag retTag = method.tags("return")[0];
                javaDocMap.put(method.qualifiedName() + "." + "returnCommentTag",
                               retTag.text());
            }
        }

    }
    javaDocMap.store(os, "");
    os.flush();
    os.close();
    return true;
}
 
Example 2
Source File: Util.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example 3
Source File: Util.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example 4
Source File: Util.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example 5
Source File: Util.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example 6
Source File: Util.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example 7
Source File: Util.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example 8
Source File: Util.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example 9
Source File: Util.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example 10
Source File: Util.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example 11
Source File: Util.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example 12
Source File: Util.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example 13
Source File: PSOperatorDoc.java    From PrivacyStreams with Apache License 2.0 5 votes vote down vote up
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;
    }
 
Example 14
Source File: Util.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example 15
Source File: Util.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example 16
Source File: Util.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example 17
Source File: Util.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example 18
Source File: Util.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example 19
Source File: Util.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example 20
Source File: Util.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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;
}