Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

import java.lang.reflect.Method;

import java.util.ArrayList;
import java.util.List;

public class Main {
    public static Method[] getMethodsByName(Class<?> clazz, String name) {
        Method[] methods = clazz.getMethods();
        List<Method> list = new ArrayList<Method>();

        for (Method method : methods) {
            if (method.getName().equals(name))
                list.add(method);
        }

        return list.toArray(new Method[list.size()]);
    }
}