org.mentabean.util
Class FindMethod

java.lang.Object
  extended by org.mentabean.util.FindMethod

public class FindMethod
extends Object

Find method with polymorphism! Class.getMethod only finds an exact match.

Author:
Jon Skeet (http://groups.google.com/group/comp.lang.java.programmer/browse_thread/thread/921ab91865c8cc2e/9e141d3d62e7cb3f)

Constructor Summary
FindMethod()
           
 
Method Summary
static Method getDeclaredMethod(Class<? extends Object> source, String name, Class<? extends Object>[] parameterTypes)
          Finds the most specific applicable declared method
static Method getMethod(Class<? extends Object> source, String name, Class<? extends Object>[] parameterTypes)
          Finds the most specific applicable method
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FindMethod

public FindMethod()
Method Detail

getMethod

public static Method getMethod(Class<? extends Object> source,
                               String name,
                               Class<? extends Object>[] parameterTypes)
                        throws NoSuchMethodException
Finds the most specific applicable method

Parameters:
source - Class to find method in
name - Name of method to find
parameterTypes - Parameter types to search for
Throws:
NoSuchMethodException

getDeclaredMethod

public static Method getDeclaredMethod(Class<? extends Object> source,
                                       String name,
                                       Class<? extends Object>[] parameterTypes)
                                throws NoSuchMethodException
Finds the most specific applicable declared method

Parameters:
source - Class to find method in
name - Name of method to find
parameterTypes - Parameter types to search for
Throws:
NoSuchMethodException


Copyright © 2013. All Rights Reserved.