获得指定类的单例对象<br>
对象存在于池中返回，否则创建，每次调用此方法获得的对象为同一个对象<br>
注意：单例针对的是类和对象，因此get方法第一次调用时创建的对象始终唯一，也就是说就算参数变更，返回的依旧是第一次创建的对象

@param <T> 单例对象类型
@param className 类名
@param params 构造参数
@return 单例对象
9318
public static <T> T get(String className, Object... params) {
		final Class<T> clazz = ClassUtil.loadClass(className);
		return get(clazz, params);
	}
968092
private static Method getMethod(final Class<?> mbean,
                                  final String method,
                                  final String... params) {
    try {
      final ClassLoader loader = mbean.getClassLoader();
      final Class<?>[] paramClasses = new Class<?>[params.length];
      for (int i = 0; i < params.length; i++) {
        paramClasses[i] = primitives.get(params[i]);
        if (paramClasses[i] == null) {
          paramClasses[i] = Class.forName(params[i], false, loader);
        }
      }
      return mbean.getMethod(method, paramClasses);
    } catch (RuntimeException e) {
      throw e;
    } catch (Exception e) {
      return null;
    }
  }
1011107
public Method getJavaMethod(Class<?> clazz, String methodName, Class... parameterTypes) {
        String clazzName = clazz.getName();
        String methodKey = buildMethodKey(clazzName, methodName, parameterTypes);

        Method method = methodCache.get(methodKey);
        if (null == method) {
            getFastClass(clazz);// 分析一次clazz,这时会跟新methodCache
            return methodCache.get(methodKey);
        } else {
            return method;
        }
    }
843149
def class_param_names(cls, hidden=True):
        
        param_names = set(
            k for (k, v) in cls.__dict__.items()
            if isinstance(v, Parameter)
        )
        for parent in cls.__bases__:
            if hasattr(parent, 'class_param_names'):
                param_names |= parent.class_param_names(hidden=hidden)

        if not hidden:
            param_names = set(n for n in param_names if not n.startswith('_'))
        return param_names
728998
public static ObjectMethodMatchConf match(Method method, Class[] paras)
	{
		Class[] metodParaTypes = method.getParameterTypes();
		if (paras.length < metodParaTypes.length)
		{

			return null;
		}
		else if (paras.length == metodParaTypes.length)
		{
			//精确匹配或者可变参数
		}
		else if (paras.length > metodParaTypes.length && metodParaTypes.length != 0
				&& metodParaTypes[metodParaTypes.length - 1].isArray())
		{
			//可变参数，
		}
		else
		{
			//不匹配
			return null;
		}

		int[] convert = new int[metodParaTypes.length];

		for (int j = 0; j < paras.length; j++)
		{

			if (paras[j] == null)
			{
				// 认为匹配
				convert[j] = NO_CONVERT;
				continue;
			}

			if (paras[j] == metodParaTypes[j])
			{
				convert[j] = NO_CONVERT;
				continue;
			}

			if (metodParaTypes[j] == Object.class)
			{

				convert[j] = NO_CONVERT;

				continue;
			}
			else if (metodParaTypes[j].isAssignableFrom(paras[j]))
			{
				convert[j] = NO_CONVERT;
				continue;
			}
			else if (metodParaTypes[j].isPrimitive() && Number.class.isAssignableFrom(paras[j]))
			{
				//匹配，但需要类型转化
				if (metodParaTypes[j] == int.class)
				{
					convert[j] = INT_CONVERT;
				}
				else if (metodParaTypes[j] == byte.class)
				{
					convert[j] = BYTE_CONVERT;
				}
				else if (metodParaTypes[j] == char.class)
				{
					convert[j] = CHAR_CONVERT;
				}
				else if (metodParaTypes[j] == long.class)
				{
					convert[j] = LONG_CONVERT;
				}
				else if (metodParaTypes[j] == double.class)
				{
					convert[j] = DOUBLE_CONVERT;
				}
				else if (metodParaTypes[j] == float.class)
				{
					convert[j] = FLOAT_CONVERT;
				}
				else if (metodParaTypes[j] == short.class)
				{
					convert[j] = SHORT_CONVERT;
				}
				continue;

			}
			else if (Number.class.isAssignableFrom(metodParaTypes[j]) && Number.class.isAssignableFrom(paras[j]))
			{
				//匹配，但需要类型转化
				if (metodParaTypes[j] == Integer.class)
				{
					convert[j] = INT_CONVERT;
				}
				else if (metodParaTypes[j] == Byte.class)
				{
					convert[j] = BYTE_CONVERT;
				}
				else if (metodParaTypes[j] == Character.class)
				{
					convert[j] = CHAR_CONVERT;
				}
				else if (metodParaTypes[j] == Long.class)
				{
					convert[j] = LONG_CONVERT;
				}
				else if (metodParaTypes[j] == Double.class)
				{
					convert[j] = DOUBLE_CONVERT;
				}
				else if (metodParaTypes[j] == Float.class)
				{
					convert[j] = FLOAT_CONVERT;
				}
				else if (metodParaTypes[j] == Short.class)
				{
					convert[j] = SHORT_CONVERT;
				}
				else if (metodParaTypes[j] == BigDecimal.class)
				{
					convert[j] = BIGDECIMAL_CONVERT;
				}
				continue;

			}

			else if (metodParaTypes[j] == Boolean.class)
			{
				if (paras[j] == boolean.class)
				{
					convert[j] = NO_CONVERT;
					continue;
				}
			}
			else if (metodParaTypes[j] == boolean.class)
			{
				if (paras[j] == Boolean.class)
				{
					convert[j] = NO_CONVERT;
					continue;
				}
			}
			else if (metodParaTypes[j] == Character.class)
			{
				if (paras[j] == char.class)
				{
					convert[j] = CHAR_CONVERT;
					continue;
				}
			}
			else if (metodParaTypes[j] == char.class)
			{
				if (paras[j] == Character.class)
				{
					convert[j] = CHAR_CONVERT;
					continue;
				}
			}
			else if (metodParaTypes[j].isArray())
			{

				if (paras[j].isArray())
				{
					Class metodParaTypeComponent = metodParaTypes[j].getComponentType();
					Class paraTypeComponent = paras[j].getComponentType();
					if (metodParaTypeComponent == paraTypeComponent)
					{
						//不做转化了
						convert[j] = NO_CONVERT;
						continue;
					}
					return null;
				}
				else if (j == metodParaTypes.length - 1)
				{
					convert[j] = VARIABLE_ARRAY;
					break;
				}
				else
				{
					return null;
				}

			}

			return null;

		}
		ObjectMethodMatchConf mc = new ObjectMethodMatchConf();
		mc.method = method;
		mc.convert = convert;
		for (int c : convert)
		{
			if (c != 0)
			{
				mc.isNeedConvert = true;
				break;
			}
		}
		mc.method.setAccessible(true);
		return mc;

	}
124544
static String toParamString(Class<?>[] params) {
		if (params == null || params.length == 0) {
			return "()";
		}
		StringBuilder s = new StringBuilder();
		s.append('(');
		for (int i = 0, max = params.length; i < max; i++) {
			if (i > 0) {
				s.append(", ");
			}
			if (params[i] == null) {
				s.append("null");
			}
			else {
				s.append(params[i].getName());
			}
		}
		s.append(')');
		return s.toString();
	}
283422
public String getKey(String tableName, String query, Object[] params) {
        return tableName + query + (params == null ? null : Arrays.asList(params).toString());
    }
1259552
public static Method findMatchingMethod(Class<?> classToInspect, Class<?> returnType, Object... params) {
        Method[] methods = classToInspect.getMethods();
        Method checkedMethod = null;
        for (Method method : methods) {
            Type[] parameterTypes = method.getParameterTypes();
            // if the return type is not specified (i.e null) we only check the parameters
            boolean matchReturnType = returnType == null || returnType.equals(method.getReturnType());

            if (checkParams(parameterTypes, params) && matchReturnType) {
                if (checkedMethod == null) {
                    checkedMethod = method;
                } else {
                    throw BusinessException.createNew(BusinessErrorCode.AMBIGUOUS_METHOD_FOUND)
                            .put("method1", method)
                            .put("method2", checkedMethod)
                            .put("object", classToInspect.getSimpleName())
                            .put("parameters", params);
                }
            }
        }
        return checkedMethod;
    }
797575
protected HashMap getMethodMap(Class cl)
    {
        HashMap methodMap = new HashMap();

        for (; cl != null; cl = cl.getSuperclass()) {
            Method[] methods = cl.getDeclaredMethods();

            for (int i = 0; i < methods.length; i++) {
                Method method = methods[i];

                if (Modifier.isStatic(method.getModifiers()))
                    continue;

                String name = method.getName();

                if (!name.startsWith("set"))
                    continue;

                Class[] paramTypes = method.getParameterTypes();
                if (paramTypes.length != 1)
                    continue;

                if (!method.getReturnType().equals(void.class))
                    continue;

                if (findGetter(methods, name, paramTypes[0]) == null)
                    continue;

                // XXX: could parameterize the handler to only deal with public
                try {
                    method.setAccessible(true);
                } catch (Throwable e) {
                    e.printStackTrace();
                }

                name = name.substring(3);

                int j = 0;
                for (; j < name.length() && Character.isUpperCase(name.charAt(j)); j++) {
                }

                if (j == 1)
                    name = name.substring(0, j).toLowerCase(Locale.ENGLISH) + name.substring(j);
                else if (j > 1)
                    name = name.substring(0, j - 1).toLowerCase(Locale.ENGLISH) + name.substring(j - 1);

                methodMap.put(name, method);
            }
        }

        return methodMap;
    }
1045706
public static Object constructByNamedParams(Class clazz, Map params) throws Exception {
        Object obj = clazz.getConstructor().newInstance();

        Method[] allMethods = clazz.getMethods();
        for(Method method : allMethods) {
            if(method.getName().startsWith("set")) {
                Object [] o = new Object [1];
                String propertyName = Introspector.decapitalize(method.getName().substring(3));
                if (params.containsKey(propertyName)) {
                    o[0] = params.get(propertyName);
                    method.invoke(obj, o);
                }
            }
        }
        return obj;
    }
1027083
public FastMethod getFastMethod(Class<?> clazz, String methodName, Class... parameterTypes) {
        String clazzName = clazz.getName();
        String methodKey = buildMethodKey(clazzName, methodName, parameterTypes);

        FastMethod method = fastMethodCache.get(methodKey);
        if (null == method) {
            getFastClass(clazz);// 分析一次clazz,这时会跟新fastMethodCache
            return fastMethodCache.get(methodKey);
        } else {
            return method;
        }
    }
487159
private List<Method> paramGetMethods() {

        List<Method> list = new ArrayList<Method>();
        Method[] methods = this.getClass().getMethods();
        int length = methods.length;
        for (int i = 0; i < length; i++) {
            Method method = methods[i];
            if (method.getName().startsWith("getParam") && (method.getParameterTypes().length == 0)) {
                if (DEBUG) {
                    System.err.println("getMethod: " + method.getName());
                }
                list.add(method);
            }
        }
        return list;
    }
924338
public static QueryParameter getParameterByName(List<QueryParameter> params, String parameterName) {
        for (QueryParameter parameter : params) {
            if (parameter.getName().equals(parameterName)) {
                return parameter;
            }
        }
        return null;
    }
905951
public String getURL(String classname, String params) throws IOException, SQLException {
		try {
			Class<? extends WebPage> clazz=Class.forName(classname).asSubclass(WebPage.class);
			return getURL(clazz, params);
		} catch(ClassNotFoundException err) {
			throw new IOException("Unable to load class: "+classname, err);
		}
	}
137523
public static String[] getMethodParameterNames(Class<?> declaringClass, final Method method) {
        final Class<?>[] parameterTypes = method.getParameterTypes();
        if (parameterTypes == null || parameterTypes.length == 0) {
            return new String[0];
        }

        Map<Member, String[]> map = parameterNamesCache.get(declaringClass);
        if (map == null) {
            map = inspectClass(declaringClass);
            parameterNamesCache.put(declaringClass, map);
        }
        if (map != NO_DEBUG_INFO_MAP) {
            return map.get(method);
        }
        return null;
    }
755159
public static Map<String, Method> getGetters(Class<?> clazz) {
		Map<String, Method> getters = new HashMap<String, Method>();
		Method[] methods = clazz.getMethods();
		for (Method method : methods) {
			String methodName = method.getName();
			if (method.getParameterTypes().length == 0) {
				if (methodName.startsWith("get") && methodName.length() > 3) {
					String propertyName = methodName.substring(3, 4)
							.toLowerCase();
					if (methodName.length() > 4) {
						propertyName += methodName.substring(4);
					}
					getters.put(propertyName, method);
				} else if (methodName.startsWith("is")
						&& methodName.length() > 2
						&& Boolean.TYPE.equals(method.getReturnType())) {
					String propertyName = methodName.substring(2, 3)
							.toLowerCase();
					if (methodName.length() > 3) {
						propertyName += methodName.substring(3);
					}
					getters.put(propertyName, method);
				}
			}
		}
		return getters;
	}
1106851
public static Method findMethod(Object obj, String methodName, Object... params) {
        Class<?>[] classArray = new Class<?>[params.length];
        for (int i = 0; i < params.length; i++) {
            classArray[i] = params[i].getClass();
        }
        try {
            //look on all the public, protected, default and private methods of the class hierarchy.
            Class<?> klass = obj.getClass();
            while (klass != null) {
                for (Method method : klass.getDeclaredMethods()) {
                    //check if the method name matches along with the number of parameters
                    if (method.getName().equals(methodName) && method.getParameterCount() == classArray.length) {
                        Class<?>[] paramClasses = method.getParameterTypes();

                        //Then check one by one all the provided parameters and see if they match the defined ones.
                        boolean parametersMatch = true;
                        for(int i = 0; i < params.length; i++) {
                            if(!paramClasses[i].isAssignableFrom(classArray[i])) {
                                parametersMatch = false;
                                break;
                            }
                        }

                        if(parametersMatch) { //exact match, return the method
                            return method;
                        }
                    }
                }
                klass = klass.getSuperclass();
            }

            //nothing found
            throw new NoSuchMethodException();
        }
        catch (NoSuchMethodException ex) {
            throw new RuntimeException(ex);
        }
    }