集册 Java实例教程 以字符串数组形式返回方法的签名。

以字符串数组形式返回方法的签名。

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

418
以字符串数组形式返回方法的签名。


//package com.nowjava;

import java.lang.reflect.Method;/* 来 自 n o w    j a v a  . c o m*/


public class Main {

    /**

     * Return the signature of method as an array of strings.

     *

     * @param method the method.

     * @return the signature.

     */

    public static String[] getSignature(final Method method) {

        final Class[] types = method.getParameterTypes();

        final String[] signature = new String[types.length];

        for (int i = 0; i < 
展开阅读全文