Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.lang.reflect.Method;

public class Main {
    public static String[] getMethodParameter(Method method) {
        Class<?>[] paramTypes = method.getParameterTypes();
        if (paramTypes.length == 0) {
            return null;
        }
        String[] result = new String[paramTypes.length];
        int i = 0;
        for (Class<?> c : paramTypes) {
            result[i++] = c.getName();
        }
        return result;
    }

    public static String[] getMethodParameter(Object[] parameters) {
        if (parameters.length == 0) {
            return null;
        }
        String[] result = new String[parameters.length];
        int i = 0;
        for (Object c : parameters) {
            result[i++] = c.getClass().getName();
        }
        return result;
    }
}