Given the multiple cardinality feature, the range of the get method is returned.
@param getMethod default method

@return the range as a class
764670
protected static Class detectRange(Method getMethod)
	{
		Class range = getMethod.getReturnType();
		//if the return type is a collection then we have multiple cardinality
		if (Collection.class.isAssignableFrom(range))
		{
			//it is a collection, by default assume non parameterized.
			range = Object.class;
			//If the collection is parameterized, get it.
			Type genericReturnType = getMethod.getGenericReturnType();
			if (genericReturnType instanceof ParameterizedType)
			{
				try
				{
					range = (Class) ((ParameterizedType) genericReturnType).getActualTypeArguments()[0];
				}
				catch (Exception e)
				{
					e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
				}
				//Now this is required as autoboxing will not work with reflection
				if (range == Double.class)
				{
					range = double.class;
				}
				if (range == Float.class)
				{
					range = float.class;
				}
				if (range == Integer.class)
				{
					range = int.class;
				}
			}
			if (log.isTraceEnabled()) log.trace(range.getCanonicalName());
		}

		return range;
	}
1160020
public com.google.api.Distribution.Range getRange() {
    return range_ == null ? com.google.api.Distribution.Range.getDefaultInstance() : range_;
  }
552020
public JMethod getMethod(String name, JClass []paramTypes)
  {
    loop:
    for (JMethod method : getMethods()) {
      if (! method.getName().equals(name))
        continue;

      JClass []mParamTypes = method.getParameterTypes();
      if (mParamTypes.length != paramTypes.length)
        continue;

      for (int i = 0; i < paramTypes.length; i++) {
        if (! paramTypes[i].getName().equals(mParamTypes[i].getName()))
          continue loop;
      }


      return method;
    }

    return null;
  }
1265362
private MethodCode getSizeMethodCode() {
        MethodCode mc = new MethodCode();
        mc.setName("size");
        mc.setScope(ClassCode.SCOPE_PUBLIC);
        mc.setReturnType("int");
        mc.addParameter(ClassHelper.getInternalName(cls.getCanonicalName()), "t");
        mc.addException("IOException");

        // add method code
        mc.appendLineCode1("int size = 0");

        Set<Integer> orders = new HashSet<Integer>();
        // encode method
        for (FieldInfo field : fields) {

            boolean isList = field.isList();

            // check type
            if (!isList) {
                checkType(field.getFieldType(), field.getField());
            }

            if (orders.contains(field.getOrder())) {
                throw new IllegalArgumentException("Field order '" + field.getOrder() + "' on field"
                        + field.getField().getName() + " already exsit.");
            }
            // define field
            mc.appendLineCode0(CodedConstant.getMappedTypeDefined(field.getOrder(), field.getFieldType(),
                    getAccessByField("t", field.getField(), cls), isList));
            // compute size
            StringBuilder code = new StringBuilder();
            code.append("if (!CodedConstant.isNull(").append(getAccessByField("t", field.getField(), cls)).append("))")
                    .append("{");
            mc.appendLineCode0(code.toString());

            code.setLength(0);
            code.append("size += ");
            code.append(CodedConstant.getMappedTypeSize(field, field.getOrder(), field.getFieldType(), isList, debug,
                    outputPath));
            code.append("}");
            mc.appendLineCode0(code.toString());

            if (field.isRequired()) {
                mc.appendLineCode0(CodedConstant.getRequiredCheck(field.getOrder(), field.getField()));
            }
        }

        mc.appendLineCode1("return size");

        return mc;
    }
1315827
public static Method getDeclaredMethod(final Class cls, final String methodName) {
		return getMethod(cls, methodName, true);
	}
905465
public static Method getMethod(Class clazz, String methodName, Class<?>... parameterTypes) {
        if (clazz == null) {
            return null;
        }
        try {
            return clazz.getDeclaredMethod(methodName, parameterTypes);
        } catch (SecurityException e) {
            e.printStackTrace();
        } catch (NoSuchMethodException e) {
            e.printStackTrace();
        }
        return null;
    }
1372387
static Method getMethod(Class<?> cls, String name) throws NoSuchMethodException {
    NoSuchMethodException firstExc = null;
    for (Class<?> c = cls; c != null; c = c.getSuperclass()) {
      try {
        return c.getDeclaredMethod(name);
      } catch (NoSuchMethodException e) {
        if (firstExc == null) {
          firstExc = e;
        }
      }
    }
    throw firstExc;
  }
714408
public Method getMethod(Class<?> returnType, String name, Class<?>... paramTypes) {
        final Map<ParamList, Map<Class<?>, Method>> nameMap = methods.get(name);
        if (nameMap == null) {
            return null;
        }
        final Map<Class<?>, Method> paramsMap = nameMap.get(createParamList(paramTypes));
        if (paramsMap == null) {
            return null;
        }
        return paramsMap.get(returnType);
    }
1297515
public com.groupon.odo.proxylib.models.Method getMethod(String className, String methodName) throws Exception {
        // TODO: fix this so it returns the right override ID
        com.groupon.odo.proxylib.models.Method m = null;

        // calls getClass first in case the loaded class needs to be invalidated
        Class<?> gottenClass = getClass(className);
        ClassInformation classInfo = classInformation.get(className);

        String fullName = className + "." + methodName;
        if (methodInformation.containsKey(fullName)) {
            m = methodInformation.get(fullName);
        } else {
            logger.info("Getting method info: {}", fullName);

            // Make a new classpool with the system classpath URLS
            // We create a new classpool each time since we want to reload plugin information in case it has changed.
            // Once a method is loaded this should not get called so the extra expense is not always taken as a hit
            ClassPool classPool = new ClassPool();
            ClassLoader sysClassLoader = Thread.currentThread().getContextClassLoader();

            //Get the URLs
            URL[] urls = ((URLClassLoader) sysClassLoader).getURLs();
            for (int i = 0; i < urls.length; i++) {
                try {
                    // insert all classpaths into the javassist classpool
                    File f1 = new File(urls[i].getFile());

                    if (f1.exists()) {
                        // only add if file exists to avoid an uncatchable exception in Java 8
                        classPool.insertClassPath(urls[i].getFile());
                    }
                } catch (NotFoundException e) {
                    e.printStackTrace();
                }
            }
            classPool.insertClassPath(classInfo.pluginPath);

            // load method information
            Method[] methods = gottenClass.getDeclaredMethods();
            for (Method method : methods) {
                if (method.getName().compareTo(methodName) != 0) {
                    continue;
                }

                try {
                    // get annotation information
                    Annotation[] annotations = method.getAnnotations();
                    for (Annotation annotation : annotations) {
                        com.groupon.odo.proxylib.models.Method newMethod = new com.groupon.odo.proxylib.models.Method();
                        newMethod.setClassName(className);
                        newMethod.setMethodName(methodName);
                        newMethod.setMethod(method);
                        newMethod.setMethodType(annotation.annotationType().toString());

                        String[] argNames = null;
                        String[] defaultArgs = null;
                        String description = null;

                        // Convert to the right type and get annotation information
                        if (annotation.annotationType().toString().endsWith(Constants.PLUGIN_RESPONSE_OVERRIDE_CLASS)) {
                            ResponseOverride roAnnotation = (ResponseOverride) annotation;
                            newMethod.setHttpCode(roAnnotation.httpCode());
                            description = roAnnotation.description();
                            argNames = roAnnotation.parameters();
                            defaultArgs = new String[0];
                            newMethod.setOverrideVersion(1);
                        } else if (annotation.annotationType().toString().endsWith(Constants.PLUGIN_RESPONSE_OVERRIDE_V2_CLASS)) {
                            com.groupon.odo.plugin.v2.ResponseOverride roAnnotation = (com.groupon.odo.plugin.v2.ResponseOverride) annotation;
                            description = roAnnotation.description();
                            argNames = roAnnotation.parameters();
                            defaultArgs = roAnnotation.argDefaults();
                            newMethod.setBlockRequest(roAnnotation.blockRequest());
                            newMethod.setOverrideVersion(2);
                        } else {
                            continue;
                        }

                        // identify arguments
                        // first arg is always a reserved that we skip
                        ArrayList<String> params = new ArrayList<String>();
                        if (method.getParameterTypes().length > 1) {
                            for (int x = 1; x < method.getParameterTypes().length; x++) {
                                params.add(method.getParameterTypes()[x].getName());
                            }
                        }
                        newMethod.setMethodArguments(params.toArray(new Object[0]));
                        newMethod.setMethodArgumentNames(argNames);
                        newMethod.setMethodDefaultArguments(defaultArgs);
                        newMethod.setDescription(description);
                        newMethod.setIdString(className + "." + methodName);

                        methodInformation.put(fullName, newMethod);
                        m = newMethod;
                    }

                    break;
                } catch (Exception e) {
                    // in this case we just return null since the method would be unuseable
                    return null;
                }
            }
        }

        return m;
    }
126518
static boolean isGetterMethod(final Method method) {
        return (method.getName().startsWith(GETTER_GET_METHOD_PREFIX)
                || method.getName().startsWith(GETTER_IS_METHOD_PREFIX))
                &&
                !Void.TYPE.isAssignableFrom(method.getReturnType())
                &&
                !method.isVarArgs()
                &&
                method.getParameterTypes().length == 0;
    }
459151
public static Method getMethod(Class<?> clazz, String methodName, Class<?>... parameterTypes) {
        if (clazz == null || methodName == null || methodName.length() == 0) {
            return null;
        }

        for (Class<?> itr = clazz; hasSuperClass(itr); ) {
            Method[] methods = itr.getDeclaredMethods();

            for (Method method : methods) {
                if (method.getName().equals(methodName) && Arrays.equals(method.getParameterTypes(), parameterTypes)) {
                    return method;
                }
            }

            itr = itr.getSuperclass();
        }
        return null;
    }
1253331
public Method getMethod(Method method) {
        return getMethod(method.getReturnType(), method.getName(), method.getParameterTypes());
    }
625330
private static Object filterPropertyMethod(Object methodOrList, boolean isGetter, boolean booleanGetter) {
        // Method has been optimized to reach a target of 325 bytecode size, making it JIT'able
        Object ret = null;

        if (methodOrList instanceof MetaMethod) {
            MetaMethod element = (MetaMethod)methodOrList;
            int parameterCount = element.getParameterTypes().length;
            if (!isGetter &&
                    //(element.getReturnType() == Void.class || element.getReturnType() == Void.TYPE) &&
                    parameterCount == 1) {
                ret = element;
            }
            Class returnType = element.getReturnType();
            if (isGetter &&
                    !(returnType == Void.class || returnType == Void.TYPE) &&
                    (!booleanGetter || returnType == Boolean.class || returnType == Boolean.TYPE) &&
                    parameterCount == 0) {
                ret = element;
            }
        }
        if (methodOrList instanceof FastArray) {
            FastArray methods = (FastArray) methodOrList;
            final int len = methods.size();
            final Object[] data = methods.getArray();
            for (int i = 0; i != len; ++i) {
                MetaMethod element = (MetaMethod) data[i];
                int parameterCount = element.getParameterTypes().length;
                if (!isGetter &&
                        //(element.getReturnType() == Void.class || element.getReturnType() == Void.TYPE) &&
                        parameterCount == 1) {
                    ret = addElementToList(ret, element);
                }
                Class returnType = element.getReturnType();
                if (isGetter &&
                        !(returnType == Void.class || returnType == Void.TYPE) &&
                        parameterCount == 0) {
                    ret = addElementToList(ret, element);
                }
            }
        }

        if (ret == null
                || (ret instanceof MetaMethod)
                || !isGetter) {
            return ret;
        }

        // we found multiple matching methods
        // this is a problem, because we can use only one
        // if it is a getter, then use the most general return
        // type to decide which method to use. If it is a setter
        // we use the type of the first parameter
        MetaMethod method = null;
        int distance = -1;
        for (final Object o : ((List) ret)) {
            MetaMethod element = (MetaMethod) o;
            int localDistance = distanceToObject(element.getReturnType());
            //TODO: maybe implement the case localDistance==distance
            if (distance == -1 || distance > localDistance) {
                distance = localDistance;
                method = element;
            }
        }
        return method;
    }
1361484
private Class getTargetClass(Method setMethod) {
        Class[] params = setMethod.getParameterTypes();
        if (params == null || params.length != 1) {
            throw new BeanMappingException("illegal set method[" + setMethod.getName() + "] for ParameterType");
        }
        return params[0];
    }
338787
public static Class getMethodGenericReturnType(Method method, int index) {
    	Type returnType = method.getGenericReturnType();
    	if(returnType instanceof ParameterizedType){
    	    ParameterizedType type = (ParameterizedType) returnType;
    	    Type[] typeArguments = type.getActualTypeArguments();
            if (index >= typeArguments.length || index < 0) {
				throw new IllegalArgumentException("index "+ (index<0 ? " must > 0 " : " over total arguments"));
			}
    	    return (Class)typeArguments[index];
    	}
    	return Object.class;
    }
1154702
public static Method getMethod(Class<?> clazz, String methodName, Class<?>... parameterTypes) {
        Assert.notNull(clazz, "类型不能为空");
        Assert.notNull(methodName, "方法名不能为空");

        return METHOD_CACHE.compute(new MethodKey(methodName, clazz, parameterTypes), (k, v) -> {
            if (v == null) {
                try {
                    return allowAccess(clazz.getDeclaredMethod(methodName, parameterTypes));
                } catch (NoSuchMethodException e) {
                    log.error(
                        StringUtils.format("类[{0}]中不存在方法名为[{1}]、方法列表为[{2}]的方法", clazz, methodName,
                            parameterTypes == null ? "null" : Arrays.toString(parameterTypes)));
                    throw new ReflectException(
                        StringUtils.format("类[{0}]中不存在方法名为[{1}]、方法列表为[{2}]的方法", clazz, methodName,
                            parameterTypes == null ? "null" : Arrays.toString(parameterTypes)),
                        e);
                }
            } else {
                return v;
            }
        });
    }
205943
private static Method getMethod(String methodName, Class<?> clazz, Class<?>... args) {
        Method method;
        try {
            method = clazz.getMethod(methodName, args);
        } catch (NoSuchMethodException e1) {
            method = null;
        }
        return method;
    }