Package com.esotericsoftware.reflectasm

Examples of com.esotericsoftware.reflectasm.MethodAccess.invoke()


    Method method = SomeClass.class.getMethod("getName");

    for (int i = 0; i < 100; i++) {
      for (int ii = 0; ii < count; ii++)
        dontCompileMeAway[ii] = access.invoke(someObject, index);
      for (int ii = 0; ii < count; ii++)
        dontCompileMeAway[ii] = method.invoke(someObject);
    }
    warmup = false;
View Full Code Here


    warmup = false;

    for (int i = 0; i < 100; i++) {
      start();
      for (int ii = 0; ii < count; ii++)
        dontCompileMeAway[ii] = access.invoke(someObject, index);
      end("MethodAccess");
    }
    for (int i = 0; i < 100; i++) {
      start();
      for (int ii = 0; ii < count; ii++)
View Full Code Here

    Method method = SomeClass.class.getMethod("getName");
    // method.setAccessible(true); // Improves reflection a bit.

    for (int i = 0; i < 100; i++) {
      for (int ii = 0; ii < count; ii++)
        dontCompileMeAway[ii] = access.invoke(someObject, index, args);
      for (int ii = 0; ii < count; ii++)
        dontCompileMeAway[ii] = method.invoke(someObject, args);
    }
    warmup = false;
View Full Code Here

    warmup = false;

    for (int i = 0; i < 100; i++) {
      start();
      for (int ii = 0; ii < count; ii++)
        dontCompileMeAway[ii] = access.invoke(someObject, index, args);
      end("MethodAccess");
    }
    for (int i = 0; i < 100; i++) {
      start();
      for (int ii = 0; ii < count; ii++)
View Full Code Here

      Object processor = processorClass.newInstance();
      Object[] args = request.getArgs();

      MethodAccess method = serviceProvider.getMethodAccess();
      int methodIndex = method.getIndex(methodName,request.getArgsTypes());
      result = method.invoke(processor, methodIndex, args);
    } catch (InstantiationException e) {
      logger.error(e.getMessage(), e);
      throw new RuntimeException(e);
    } catch (IllegalAccessException e) {
      logger.error(e.getMessage(), e);
View Full Code Here

      if (args != null && args.length != 0) {
        Class<?>[] clazz = new Class<?>[args.length];
        for (int i = 0; i < args.length; ++i) {
          clazz[i] = args[i].getClass();
        }
        return access.invoke(host, access.getIndex(methodName, clazz), args);
      }
        return access.invoke(host, methodName, args);
    }

}
View Full Code Here

        for (int i = 0; i < args.length; ++i) {
          clazz[i] = args[i].getClass();
        }
        return access.invoke(host, access.getIndex(methodName, clazz), args);
      }
        return access.invoke(host, methodName, args);
    }

}
View Full Code Here

   */
  @Test
  public void testGetMethodAccess() {
    MethodAccess ac = FastMethodUtil.getMethodAccess(MethodTestBean.class);
    MethodTestBean host = new MethodTestBean("niolex-common-utils");
    String name = (String)ac.invoke(host, "echoName");
    assertEquals(name, "niolex-common-utils");
  }

  /**
   * Test method for {@link org.apache.niolex.commons.reflect.FastMethodUtil#invokeMethod(java.lang.String, java.lang.Object, java.lang.Object[])}.
View Full Code Here

      if (args != null && args.length != 0) {
        Class<?>[] clazz = new Class<?>[args.length];
        for (int i = 0; i < args.length; ++i) {
          clazz[i] = args[i].getClass();
        }
        return access.invoke(host, access.getIndex(methodName, clazz), args);
      }
        return access.invoke(host, methodName, args);
    }

}
View Full Code Here

        for (int i = 0; i < args.length; ++i) {
          clazz[i] = args[i].getClass();
        }
        return access.invoke(host, access.getIndex(methodName, clazz), args);
      }
        return access.invoke(host, methodName, args);
    }

}
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.