当前位置: 首页>>代码示例>>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;未经允许,请勿转载。