From 4aa731bacf619851b7fc1107cb5105d4a07e0859 Mon Sep 17 00:00:00 2001 From: dain Date: Thu, 9 Oct 2008 18:29:53 -0600 Subject: [PATCH] implemented getDeclaredConstructor method --- classpath/java/lang/Class.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/classpath/java/lang/Class.java b/classpath/java/lang/Class.java index 213d8d58c6..2d907f064b 100644 --- a/classpath/java/lang/Class.java +++ b/classpath/java/lang/Class.java @@ -219,6 +219,25 @@ public final class Class { } } + public Constructor getDeclaredConstructor(Class ... parameterTypes) + throws NoSuchMethodException + { + Constructor c = null; + Constructor[] constructors = getDeclaredConstructors(); + + for (int i = 0; i < constructors.length; ++i) { + if (match(parameterTypes, constructors[i].getParameterTypes())) { + c = constructors[i]; + } + } + + if (c == null) { + throw new NoSuchMethodException(); + } else { + return c; + } + } + private int countConstructors(boolean publicOnly) { int count = 0; if (methodTable != null) {