equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright 2000-2008 Sun Microsystems, Inc. All Rights Reserved. |
2 * Copyright 2000-2009 Sun Microsystems, Inc. All Rights Reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Sun designates this |
7 * published by the Free Software Foundation. Sun designates this |
53 static Constructor lookupConstructor(String className, |
53 static Constructor lookupConstructor(String className, |
54 Class[] paramTypes) |
54 Class[] paramTypes) |
55 { |
55 { |
56 try { |
56 try { |
57 Class<?> cl = Class.forName(className); |
57 Class<?> cl = Class.forName(className); |
58 Constructor c = cl.getDeclaredConstructor(paramTypes); |
58 Constructor<?> c = cl.getDeclaredConstructor(paramTypes); |
59 setAccessible(c); |
59 setAccessible(c); |
60 return c; |
60 return c; |
61 } catch (ClassNotFoundException x) { |
61 } catch (ClassNotFoundException x) { |
62 throw new ReflectionError(x); |
62 throw new ReflectionError(x); |
63 } catch (NoSuchMethodException x) { |
63 } catch (NoSuchMethodException x) { |
77 } |
77 } |
78 } |
78 } |
79 |
79 |
80 static Method lookupMethod(String className, |
80 static Method lookupMethod(String className, |
81 String methodName, |
81 String methodName, |
82 Class[] paramTypes) |
82 Class... paramTypes) |
83 { |
83 { |
84 try { |
84 try { |
85 Class<?> cl = Class.forName(className); |
85 Class<?> cl = Class.forName(className); |
86 Method m = cl.getDeclaredMethod(methodName, paramTypes); |
86 Method m = cl.getDeclaredMethod(methodName, paramTypes); |
87 setAccessible(m); |
87 setAccessible(m); |