Example #1
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;
  }