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

The following examples show how to use com.sun.javadoc.MethodDoc#name() . 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: StubSkeletonWriter.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Writes code to initialize the static fields for each method
 * using the Java Reflection API.
 **/
private void writeMethodFieldInitializers(IndentingWriter p)
    throws IOException
{
    for (int i = 0; i < methodFieldNames.length; i++) {
        p.p(methodFieldNames[i] + " = ");
        /*
         * Look up the Method object in the somewhat arbitrary
         * interface that we find in the Method object.
         */
        RemoteClass.Method method = remoteMethods[i];
        MethodDoc methodDoc = method.methodDoc();
        String methodName = methodDoc.name();
        Type paramTypes[] = method.parameterTypes();

        p.p(methodDoc.containingClass().qualifiedName() + ".class.getMethod(\"" +
            methodName + "\", new java.lang.Class[] {");
        for (int j = 0; j < paramTypes.length; j++) {
            if (j > 0)
                p.p(", ");
            p.p(paramTypes[j].toString() + ".class");
        }
        p.pln("});");
    }
}
 
Example 2
Source File: StubSkeletonWriter.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Writes code to initialize the static fields for each method
 * using the Java Reflection API.
 **/
private void writeMethodFieldInitializers(IndentingWriter p)
    throws IOException
{
    for (int i = 0; i < methodFieldNames.length; i++) {
        p.p(methodFieldNames[i] + " = ");
        /*
         * Look up the Method object in the somewhat arbitrary
         * interface that we find in the Method object.
         */
        RemoteClass.Method method = remoteMethods[i];
        MethodDoc methodDoc = method.methodDoc();
        String methodName = methodDoc.name();
        Type paramTypes[] = method.parameterTypes();

        p.p(methodDoc.containingClass().qualifiedName() + ".class.getMethod(\"" +
            methodName + "\", new java.lang.Class[] {");
        for (int j = 0; j < paramTypes.length; j++) {
            if (j > 0)
                p.p(", ");
            p.p(paramTypes[j].toString() + ".class");
        }
        p.pln("});");
    }
}
 
Example 3
Source File: StubSkeletonWriter.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Writes code to initialize the static fields for each method
 * using the Java Reflection API.
 **/
private void writeMethodFieldInitializers(IndentingWriter p)
    throws IOException
{
    for (int i = 0; i < methodFieldNames.length; i++) {
        p.p(methodFieldNames[i] + " = ");
        /*
         * Look up the Method object in the somewhat arbitrary
         * interface that we find in the Method object.
         */
        RemoteClass.Method method = remoteMethods[i];
        MethodDoc methodDoc = method.methodDoc();
        String methodName = methodDoc.name();
        Type paramTypes[] = method.parameterTypes();

        p.p(methodDoc.containingClass().qualifiedName() + ".class.getMethod(\"" +
            methodName + "\", new java.lang.Class[] {");
        for (int j = 0; j < paramTypes.length; j++) {
            if (j > 0)
                p.p(", ");
            p.p(paramTypes[j].toString() + ".class");
        }
        p.pln("});");
    }
}
 
Example 4
Source File: StubSkeletonWriter.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Writes code to initialize the static fields for each method
 * using the Java Reflection API.
 **/
private void writeMethodFieldInitializers(IndentingWriter p)
    throws IOException
{
    for (int i = 0; i < methodFieldNames.length; i++) {
        p.p(methodFieldNames[i] + " = ");
        /*
         * Look up the Method object in the somewhat arbitrary
         * interface that we find in the Method object.
         */
        RemoteClass.Method method = remoteMethods[i];
        MethodDoc methodDoc = method.methodDoc();
        String methodName = methodDoc.name();
        Type paramTypes[] = method.parameterTypes();

        p.p(methodDoc.containingClass().qualifiedName() + ".class.getMethod(\"" +
            methodName + "\", new java.lang.Class[] {");
        for (int j = 0; j < paramTypes.length; j++) {
            if (j > 0)
                p.p(", ");
            p.p(paramTypes[j].toString() + ".class");
        }
        p.pln("});");
    }
}
 
Example 5
Source File: StubSkeletonWriter.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Writes code to initialize the static fields for each method
 * using the Java Reflection API.
 **/
private void writeMethodFieldInitializers(IndentingWriter p)
    throws IOException
{
    for (int i = 0; i < methodFieldNames.length; i++) {
        p.p(methodFieldNames[i] + " = ");
        /*
         * Look up the Method object in the somewhat arbitrary
         * interface that we find in the Method object.
         */
        RemoteClass.Method method = remoteMethods[i];
        MethodDoc methodDoc = method.methodDoc();
        String methodName = methodDoc.name();
        Type paramTypes[] = method.parameterTypes();

        p.p(methodDoc.containingClass().qualifiedName() + ".class.getMethod(\"" +
            methodName + "\", new java.lang.Class[] {");
        for (int j = 0; j < paramTypes.length; j++) {
            if (j > 0)
                p.p(", ");
            p.p(paramTypes[j].toString() + ".class");
        }
        p.pln("});");
    }
}
 
Example 6
Source File: StubSkeletonWriter.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Writes code to initialize the static fields for each method
 * using the Java Reflection API.
 **/
private void writeMethodFieldInitializers(IndentingWriter p)
    throws IOException
{
    for (int i = 0; i < methodFieldNames.length; i++) {
        p.p(methodFieldNames[i] + " = ");
        /*
         * Look up the Method object in the somewhat arbitrary
         * interface that we find in the Method object.
         */
        RemoteClass.Method method = remoteMethods[i];
        MethodDoc methodDoc = method.methodDoc();
        String methodName = methodDoc.name();
        Type paramTypes[] = method.parameterTypes();

        p.p(methodDoc.containingClass().qualifiedName() + ".class.getMethod(\"" +
            methodName + "\", new java.lang.Class[] {");
        for (int j = 0; j < paramTypes.length; j++) {
            if (j > 0)
                p.p(", ");
            p.p(paramTypes[j].toString() + ".class");
        }
        p.pln("});");
    }
}
 
Example 7
Source File: StubSkeletonWriter.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Writes code to initialize the static fields for each method
 * using the Java Reflection API.
 **/
private void writeMethodFieldInitializers(IndentingWriter p)
    throws IOException
{
    for (int i = 0; i < methodFieldNames.length; i++) {
        p.p(methodFieldNames[i] + " = ");
        /*
         * Look up the Method object in the somewhat arbitrary
         * interface that we find in the Method object.
         */
        RemoteClass.Method method = remoteMethods[i];
        MethodDoc methodDoc = method.methodDoc();
        String methodName = methodDoc.name();
        Type paramTypes[] = method.parameterTypes();

        p.p(methodDoc.containingClass().qualifiedName() + ".class.getMethod(\"" +
            methodName + "\", new java.lang.Class[] {");
        for (int j = 0; j < paramTypes.length; j++) {
            if (j > 0)
                p.p(", ");
            p.p(paramTypes[j].toString() + ".class");
        }
        p.pln("});");
    }
}
 
Example 8
Source File: StubSkeletonWriter.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Writes code to initialize the static fields for each method
 * using the Java Reflection API.
 **/
private void writeMethodFieldInitializers(IndentingWriter p)
    throws IOException
{
    for (int i = 0; i < methodFieldNames.length; i++) {
        p.p(methodFieldNames[i] + " = ");
        /*
         * Look up the Method object in the somewhat arbitrary
         * interface that we find in the Method object.
         */
        RemoteClass.Method method = remoteMethods[i];
        MethodDoc methodDoc = method.methodDoc();
        String methodName = methodDoc.name();
        Type paramTypes[] = method.parameterTypes();

        p.p(methodDoc.containingClass().qualifiedName() + ".class.getMethod(\"" +
            methodName + "\", new java.lang.Class[] {");
        for (int j = 0; j < paramTypes.length; j++) {
            if (j > 0)
                p.p(", ");
            p.p(paramTypes[j].toString() + ".class");
        }
        p.pln("});");
    }
}
 
Example 9
Source File: StubSkeletonWriter.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Writes code to initialize the static fields for each method
 * using the Java Reflection API.
 **/
private void writeMethodFieldInitializers(IndentingWriter p)
    throws IOException
{
    for (int i = 0; i < methodFieldNames.length; i++) {
        p.p(methodFieldNames[i] + " = ");
        /*
         * Look up the Method object in the somewhat arbitrary
         * interface that we find in the Method object.
         */
        RemoteClass.Method method = remoteMethods[i];
        MethodDoc methodDoc = method.methodDoc();
        String methodName = methodDoc.name();
        Type paramTypes[] = method.parameterTypes();

        p.p(methodDoc.containingClass().qualifiedName() + ".class.getMethod(\"" +
            methodName + "\", new java.lang.Class[] {");
        for (int j = 0; j < paramTypes.length; j++) {
            if (j > 0)
                p.p(", ");
            p.p(paramTypes[j].toString() + ".class");
        }
        p.pln("});");
    }
}
 
Example 10
Source File: StubSkeletonWriter.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Writes code to initialize the static fields for each method
 * using the Java Reflection API.
 **/
private void writeMethodFieldInitializers(IndentingWriter p)
    throws IOException
{
    for (int i = 0; i < methodFieldNames.length; i++) {
        p.p(methodFieldNames[i] + " = ");
        /*
         * Look up the Method object in the somewhat arbitrary
         * interface that we find in the Method object.
         */
        RemoteClass.Method method = remoteMethods[i];
        MethodDoc methodDoc = method.methodDoc();
        String methodName = methodDoc.name();
        Type paramTypes[] = method.parameterTypes();

        p.p(methodDoc.containingClass().qualifiedName() + ".class.getMethod(\"" +
            methodName + "\", new java.lang.Class[] {");
        for (int j = 0; j < paramTypes.length; j++) {
            if (j > 0)
                p.p(", ");
            p.p(paramTypes[j].toString() + ".class");
        }
        p.pln("});");
    }
}
 
Example 11
Source File: RemoteClass.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a new Method instance for the specified method.
 **/
Method(MethodDoc methodDoc) {
    this.methodDoc = methodDoc;
    exceptionTypes = methodDoc.thrownExceptions();
    /*
     * Sort exception types to improve consistency with
     * previous implementations.
     */
    Arrays.sort(exceptionTypes, new ClassDocComparator());
    operationString = computeOperationString();
    nameAndDescriptor =
        methodDoc.name() + Util.methodDescriptorOf(methodDoc);
    methodHash = computeMethodHash();
}
 
Example 12
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 13
Source File: RemoteClass.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns the MethodDoc for the method of this remote
 * implementation class that implements the specified remote
 * method of a remote interface.  Returns null if no matching
 * method was found in this remote implementation class.
 **/
private MethodDoc findImplMethod(MethodDoc interfaceMethod) {
    String name = interfaceMethod.name();
    String desc = Util.methodDescriptorOf(interfaceMethod);
    for (MethodDoc implMethod : implClass.methods()) {
        if (name.equals(implMethod.name()) &&
            desc.equals(Util.methodDescriptorOf(implMethod)))
        {
            return implMethod;
        }
    }
    return null;
}
 
Example 14
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 15
Source File: RemoteClass.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a new Method instance for the specified method.
 **/
Method(MethodDoc methodDoc) {
    this.methodDoc = methodDoc;
    exceptionTypes = methodDoc.thrownExceptions();
    /*
     * Sort exception types to improve consistency with
     * previous implementations.
     */
    Arrays.sort(exceptionTypes, new ClassDocComparator());
    operationString = computeOperationString();
    nameAndDescriptor =
        methodDoc.name() + Util.methodDescriptorOf(methodDoc);
    methodHash = computeMethodHash();
}
 
Example 16
Source File: RemoteClass.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a new Method instance for the specified method.
 **/
Method(MethodDoc methodDoc) {
    this.methodDoc = methodDoc;
    exceptionTypes = methodDoc.thrownExceptions();
    /*
     * Sort exception types to improve consistency with
     * previous implementations.
     */
    Arrays.sort(exceptionTypes, new ClassDocComparator());
    operationString = computeOperationString();
    nameAndDescriptor =
        methodDoc.name() + Util.methodDescriptorOf(methodDoc);
    methodHash = computeMethodHash();
}
 
Example 17
Source File: RemoteClass.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns the MethodDoc for the method of this remote
 * implementation class that implements the specified remote
 * method of a remote interface.  Returns null if no matching
 * method was found in this remote implementation class.
 **/
private MethodDoc findImplMethod(MethodDoc interfaceMethod) {
    String name = interfaceMethod.name();
    String desc = Util.methodDescriptorOf(interfaceMethod);
    for (MethodDoc implMethod : implClass.methods()) {
        if (name.equals(implMethod.name()) &&
            desc.equals(Util.methodDescriptorOf(implMethod)))
        {
            return implMethod;
        }
    }
    return null;
}
 
Example 18
Source File: RemoteClass.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a new Method instance for the specified method.
 **/
Method(MethodDoc methodDoc) {
    this.methodDoc = methodDoc;
    exceptionTypes = methodDoc.thrownExceptions();
    /*
     * Sort exception types to improve consistency with
     * previous implementations.
     */
    Arrays.sort(exceptionTypes, new ClassDocComparator());
    operationString = computeOperationString();
    nameAndDescriptor =
        methodDoc.name() + Util.methodDescriptorOf(methodDoc);
    methodHash = computeMethodHash();
}
 
Example 19
Source File: RemoteClass.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns the MethodDoc for the method of this remote
 * implementation class that implements the specified remote
 * method of a remote interface.  Returns null if no matching
 * method was found in this remote implementation class.
 **/
private MethodDoc findImplMethod(MethodDoc interfaceMethod) {
    String name = interfaceMethod.name();
    String desc = Util.methodDescriptorOf(interfaceMethod);
    for (MethodDoc implMethod : implClass.methods()) {
        if (name.equals(implMethod.name()) &&
            desc.equals(Util.methodDescriptorOf(implMethod)))
        {
            return implMethod;
        }
    }
    return null;
}
 
Example 20
Source File: RemoteClass.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns the MethodDoc for the method of this remote
 * implementation class that implements the specified remote
 * method of a remote interface.  Returns null if no matching
 * method was found in this remote implementation class.
 **/
private MethodDoc findImplMethod(MethodDoc interfaceMethod) {
    String name = interfaceMethod.name();
    String desc = Util.methodDescriptorOf(interfaceMethod);
    for (MethodDoc implMethod : implClass.methods()) {
        if (name.equals(implMethod.name()) &&
            desc.equals(Util.methodDescriptorOf(implMethod)))
        {
            return implMethod;
        }
    }
    return null;
}