javamethod.java

来自「pojo的mvc框架」· Java 代码 · 共 53 行

JAVA
53
字号
package xyz.frame.util;import java.lang.annotation.Annotation;import java.lang.reflect.Method;/** * Wrapper for a java method in order to use reflection. *  * @author Guilherme Silveira */public class JavaMethod {	private Method method;	public JavaMethod(Method method) {		this.method = method;	}	/**	 * Uses reflection util to invoke its method	 * 	 * @param component	 *            component in which the method should be invoked	 * @param parameters	 *            all parameters	 * @return the method's invocation result	 * @throws MethodInvocationException	 */	public Object invoke(Object component, Object... parameters)			throws MethodInvocationException {		return ReflectionUtil.invoke(component, this.method, parameters);	}	/**	 * Returns the method's name	 * 	 * @return the name	 */	public String getName() {		return method.getName();	}	@Override	public String toString() {		return "[JavaMethod " + getName() + "]";	}	public <T extends Annotation> boolean containsAnnotation(Class<T> type) {		return this.method.isAnnotationPresent(type);	}}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?