private Getter getGetter(OgnlContext context, Object target, String propertyName)
      throws OgnlException {
    Getter result;
    Class targetClass = target.getClass();
    Map propertyMap;

    if ((propertyMap = (Map) seenGetMethods.get(targetClass)) == null) {
      propertyMap = new HashMap(101);
      seenGetMethods.put(targetClass, propertyMap);
    }
    if ((result = (Getter) propertyMap.get(propertyName)) == null) {
      try {
        Method method = OgnlRuntime.getGetMethod(context, targetClass, propertyName);

        if (method != null) {
          if (Modifier.isPublic(method.getModifiers())) {
            if (method.getReturnType().isPrimitive()) {
              propertyMap.put(
                  propertyName,
                  result =
                      generateGetter(
                          context,
                          "java.lang.Object\t\tresult;\n"
                              + targetClass.getName()
                              + "\t"
                              + "t0 = ("
                              + targetClass.getName()
                              + ")$2;\n"
                              + "\n"
                              + "try {\n"
                              + "   result = new "
                              + getPrimitiveWrapperClass(method.getReturnType()).getName()
                              + "(t0."
                              + method.getName()
                              + "());\n"
                              + "} catch (java.lang.Exception ex) {\n"
                              + "    throw new java.lang.RuntimeException(ex);\n"
                              + "}\n"
                              + "return result;"));
            } else {
              propertyMap.put(
                  propertyName,
                  result =
                      generateGetter(
                          context,
                          "java.lang.Object\t\tresult;\n"
                              + targetClass.getName()
                              + "\t"
                              + "t0 = ("
                              + targetClass.getName()
                              + ")$2;\n"
                              + "\n"
                              + "try {\n"
                              + "   result = t0."
                              + method.getName()
                              + "();\n"
                              + "} catch (java.lang.Exception ex) {\n"
                              + "    throw new java.lang.RuntimeException(ex);\n"
                              + "}\n"
                              + "return result;"));
            }
          } else {
            propertyMap.put(propertyName, result = DefaultGetter);
          }
        } else {
          propertyMap.put(propertyName, result = NotFoundGetter);
        }
      } catch (Exception ex) {
        throw new OgnlException("getting getter", ex);
      }
    }
    return result;
  }