Package org.jtester.bytecode.reflector

Examples of org.jtester.bytecode.reflector.MethodAccessor.invoke()


  private Object instancePara(Parse cells) throws Exception {
    if (this.parsePropertyMethodName != null) {
      String text = cells.text();
      try {
        MethodAccessor methodAccessor = new MethodAccessor<Object>(this, parsePropertyMethodName, String.class);
        return methodAccessor.invoke(this, new Object[] { text });
      } catch (NoSuchMethodRuntimeException e) {
        TypeAdapter typeAdapter = TypeAdapter.on(this, dtoClazz);
        return typeAdapter.parse(text);
      }
    }
View Full Code Here


    }

    public void setValue(Object obj, String value) throws Exception {
      try {
        MethodAccessor methodAccessor = new MethodAccessor<Object>(obj, parseMethodName, String.class);
        methodAccessor.invoke(obj, new Object[] { value });
      } catch (NoSuchMethodRuntimeException e) {
        Object _value = typeAdapter.parse(value);
        fieldAccessor.set(obj, _value);
      }
    }
View Full Code Here

   * @throws Exception
   */
  public static <T> T invoke(Object target, String method, Object... paras) throws Exception {
    Class[] paraClazes = getParameterClazz(paras);
    MethodAccessor accessor = new MethodAccessor(target, method, paraClazes);
    Object result = accessor.invoke(target, paras);
    return (T) result;
  }

  public static <T> T invokeUnThrow(Object target, String method, Object... paras) {
    Class[] paraClazes = getParameterClazz(paras);
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.