public SignalHandlerDefaultWInvoke(Object target, Method method) {
    this.target = target;

    FastClass fastClass =
        FastClass.create(Thread.currentThread().getContextClassLoader(), target.getClass());
    fastMethod = fastClass.getMethod(method);
  }
Exemplo n.º 2
0
  public SimpleFieldAccessor(Field field, FastClass fastClass) {
    this.field = field;

    if (field == null || fastClass == null) {
      throw new IllegalArgumentException("Arguments can't be null");
    }

    field.setAccessible(true);

    // todo log if can't access getter or setter
    try {
      getter = fastClass.getMethod(ReflectionUtil.getFieldGetterName(field), new Class[] {});
    } catch (Throwable e) {
      // no operation
    }

    try {
      setter =
          fastClass.getMethod(
              ReflectionUtil.getFieldSetterName(field), new Class[] {field.getType()});
    } catch (Throwable e) {
      // no operation
    }
  }
Exemplo n.º 3
0
  /**
   * Return getter for the given method and CGLIB FastClass.
   *
   * @param method to return getter for
   * @param fastClass is the CGLIB fast classs to make FastMethod for
   * @param eventAdapterService factory for event beans and event types
   * @return property getter
   */
  public static EventPropertyGetter getGetter(
      Method method, FastClass fastClass, EventAdapterService eventAdapterService) {
    // Get CGLib fast method handle
    FastMethod fastMethod = null;
    try {
      if (fastClass != null) {
        fastMethod = fastClass.getMethod(method);
      }
    } catch (Throwable ex) {
      log.warn(
          ".getAccessors Unable to obtain CGLib fast method implementation, msg="
              + ex.getMessage());
    }

    // Construct the appropriate property getter CGLib or reflect
    EventPropertyGetter getter;
    if (fastMethod != null) {
      getter = new CGLibPropertyGetter(method, fastMethod, eventAdapterService);
    } else {
      getter = new ReflectionPropMethodGetter(method, eventAdapterService);
    }

    return getter;
  }