org.mentabean.util
Class FindConstructor
java.lang.Object
org.mentabean.util.FindConstructor
public class FindConstructor
- extends Object
Find constructor with polymorphism! Class.getConstructor only finds an exact match.
- Author:
- Jon Skeet (http://groups.google.com/group/comp.lang.java.programmer/browse_thread/thread/921ab91865c8cc2e/9e141d3d62e7cb3f)
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
FindConstructor
public FindConstructor()
getConstructor
public static Constructor<? extends Object> getConstructor(Class<? extends Object> source,
Class<? extends Object>[] parameterTypes)
throws NoSuchMethodException
- Finds the most specific applicable constructor
- Parameters:
source - Class to find a constructor forparameterTypes - Parameter types to search for
- Throws:
NoSuchMethodException
getDeclaredConstructor
public static Constructor<? extends Object> getDeclaredConstructor(Class<? extends Object> source,
Class<? extends Object>[] parameterTypes)
throws NoSuchMethodException
- Finds the most specific applicable declared constructor
- Parameters:
source - Class to find method inparameterTypes - Parameter types to search for
- Throws:
NoSuchMethodException
Copyright © 2012. All Rights Reserved.