Package com.firefly.utils.ReflectUtils

Examples of com.firefly.utils.ReflectUtils.MethodProxy.invoke()


   
    MethodProxy getPriceProxy = proxy.getMethodProxy(ReflectUtils.getGetterMethod(Foo.class, "price"));
    System.out.println(getPriceProxy.invoke(foo));
   
    MethodProxy getPriceProxy2 = ReflectUtils.getMethodProxy(ReflectUtils.getGetterMethod(Foo.class, "price"));
    System.out.println(getPriceProxy2.invoke(foo));
   
    int times = 1000 * 1000 * 1000;
    long start = System.currentTimeMillis();
    for (int i = 0; i < times; i++) {
      getPriceProxy.invoke(foo);
View Full Code Here


    end = System.currentTimeMillis();
    System.out.println("java compiler -> " + (end - start));
   
    start = System.currentTimeMillis();
    for (int i = 0; i < times; i++) {
      getPriceProxy2.invoke(foo);
    }
    end = System.currentTimeMillis();
    System.out.println("javassist -> " + (end - start));
   
    start = System.currentTimeMillis();
View Full Code Here

    end = System.currentTimeMillis();
    System.out.println("javassist -> " + (end - start));
   
    start = System.currentTimeMillis();
    for (int i = 0; i < times; i++) {
      getPriceProxy2.invoke(foo);
    }
    end = System.currentTimeMillis();
    System.out.println("javassist -> " + (end - start));
  }
 
View Full Code Here

  }
 
  public static void main2(String[] args) throws Throwable {
    Foo foo = new Foo();
    MethodProxy proxy = ReflectUtils.getMethodProxy(ReflectUtils.getGetterMethod(Foo.class, "failure"));
    System.out.println(proxy.invoke(foo));
   
    Field field = Foo.class.getField("num2");
    System.out.println(field.getType());
    System.out.println(field.getName());
    Field info = Foo.class.getField("info");
View Full Code Here

    method.setAccessible(true);
    MethodProxy proxy = ReflectUtils.getMethodProxy(method);
   
    long start = System.currentTimeMillis();
    for (int i = 0; i < times; i++) {
      proxy.invoke(foo, "method b", true);
    }
    long end = System.currentTimeMillis();
    System.out.println(foo.getName() + " invoke: " + (end - start) + "ms");
   
    start = System.currentTimeMillis();
View Full Code Here

    long end = System.currentTimeMillis();
    System.out.println(foo.getName() + " invoke: " + (end - start) + "ms");
   
    start = System.currentTimeMillis();
    for (int i = 0; i < times; i++) {
      proxy.invoke(foo, "method b", true);
    }
    end = System.currentTimeMillis();
    System.out.println(foo.getName() + " invoke: " + (end - start) + "ms");
   
    start = System.currentTimeMillis();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.