search Method By Name from Method List - Java Reflection

Java examples for Reflection:Method Name

Description

search Method By Name from Method List

Demo Code


//package com.java2s;

import java.lang.reflect.Method;

public class Main {
    public static Method searchMethodByName(Method[] methods, String name) {
        for (Method method : methods) {
            if (method.getName().equals(name)) {
                return method;
            }//from   ww w .j a v a 2 s .  co  m
        }
        return null;
    }
}

Related Tutorials