1 package test.perf.test1; 2 3 import java.lang.reflect.*; 4 5 import test.perf.AbstractTest; 6 import test.perf.Foo; 7 8 13 public class ReflectionTest extends AbstractTest { 14 public void init() { 15 Foo.static_method(); 17 } 18 19 public void test(int lCount) throws Exception { 20 for (int i = 0; i < lCount; i++) { 21 Method m = getMethod(); 22 m.invoke(null, new Object [0]); 23 } 24 } 25 26 27 private Method getMethod() throws Exception { 28 Class c = Foo.class; 29 Method m = c.getDeclaredMethod("static_method", new Class [0]); 30 31 return m; 32 } 33 } 34 | Popular Tags |