集册 Java实例教程 获取方法签名

获取方法签名

欢马劈雪     最近更新时间:2020-01-02 10:19:05

589
获取方法签名

/**

 * BSD-style license; for more info see http://pmd.sourceforge.net/license.html

 */

//package com.nowjava;


public class Main {
/*
NowJava.com
*/



    public static final String CLINIT = "<clinit>";

    public static final String INIT = "<init>";


    public static String getMethodSignature(String name,

            Class... parameterTypes) {

        StringBuilder builder = new StringBuilder();

        builder.append(name);

        if (!(name.equals(CLINIT) || name.equals(INIT))) {
        /**
         from
        * nowjava 
        **/

            builder.append("(");

            if (parameterTypes != null) {

                for (int i = 0; i < parameterTypes.length; i++) {

                    if (i > 0) {

                        builder.append(", ");

      
展开阅读全文