當前位置: 首頁>>代碼示例>>Java>>正文


Java ClassUtils.getPublicMethod方法代碼示例

本文整理匯總了Java中org.apache.commons.lang3.ClassUtils.getPublicMethod方法的典型用法代碼示例。如果您正苦於以下問題:Java ClassUtils.getPublicMethod方法的具體用法?Java ClassUtils.getPublicMethod怎麽用?Java ClassUtils.getPublicMethod使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.commons.lang3.ClassUtils的用法示例。


在下文中一共展示了ClassUtils.getPublicMethod方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: objectGetterGet

import org.apache.commons.lang3.ClassUtils; //導入方法依賴的package包/類
/**
 * Returns the value of the object getter it there is any for the wrapped java object.
 * 
 * @param key Key that should be searched using the object getter.
 * @return Value of the property of the wrapped java object
 */
protected Object objectGetterGet(Object key) {
	Method method = null;
	Object result = Scriptable.NOT_FOUND;
	
	if (object instanceof ObjectGetter) {
		Object value = ((ObjectGetter)object).get(key);
		
		try {
			method = ClassUtils.getPublicMethod(objectClass, ObjectGetter.METHOD_NAME, ObjectGetter.METHOD_ARG_TYPES);
		} catch (Exception e) {
			throw new InternalException(e);
		}
		
		if (value != ObjectGetter.UNDEFINED_VALUE) {
			result = value;
		}
	}
	
	if (result != Scriptable.NOT_FOUND && method != null) {
		//result = new JavaMethodRedirectedWrapper(result, object, method);
	}
	
	return result;
}
 
開發者ID:jutils,項目名稱:jsen-js,代碼行數:31,代碼來源:HostedJavaObject.java

示例2: getObjectGetterMetod

import org.apache.commons.lang3.ClassUtils; //導入方法依賴的package包/類
/**
 * Returns method of the class that equals to the object getter method.
 *  
 * @param clazz Class which should contain the object getter method.
 * @return Object getter method.
 */
private static Method getObjectGetterMetod(Class<?> clazz) {
	try {
		return ClassUtils.getPublicMethod(clazz, ObjectGetter.METHOD_NAME, ObjectGetter.METHOD_ARG_TYPES);
	} catch (Exception e) {
		throw new InternalException(e);
	}
}
 
開發者ID:jutils,項目名稱:jsen-core,代碼行數:14,代碼來源:ClassFunction.java

示例3: invoke

import org.apache.commons.lang3.ClassUtils; //導入方法依賴的package包/類
/**
 * Invoke a public method on a class instance
 *
 * @param instance
 *            object on which the method should be called
 * @param methodName
 *            name of the method to be called
 * @throws SecurityException
 *             if a security violation occurred while looking for the method
 * @throws IllegalArgumentException
 *             if the method parameters (none given) do not match the
 *             signature of the method
 * @throws JMeterException
 *             if something went wrong in the invoked method
 */
public static void invoke(Object instance, String methodName)
throws SecurityException, IllegalArgumentException, JMeterException
{
    Method m;
    try {
        m = ClassUtils.getPublicMethod(instance.getClass(), methodName, new Class [] {});
        m.invoke(instance, (Object [])null);
    } catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException e) {
        throw new JMeterException(e);
    }
}
 
開發者ID:johrstrom,項目名稱:cloud-meter,代碼行數:27,代碼來源:ClassTools.java


注:本文中的org.apache.commons.lang3.ClassUtils.getPublicMethod方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。