factorymethod.java

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

JAVA
52
字号
package xyz.frame.factory;import java.lang.reflect.Method;import xyz.frame.util.JavaMethod;import xyz.frame.util.MethodInvocationException;/** * A factory method. *  * @author Guilherme Silveira */public class FactoryMethod {	private String key;	private JavaMethod method;	/**	 * Simple constructor with annotation and method	 * 	 * @param annotation	 *            the annotation	 * @param method	 *            the method	 */	public FactoryMethod(String key, Method method) {		super();		this.key = key;		this.method = new JavaMethod(method);	}	/**	 * Returns the new instance	 * 	 * @return the new instance	 * @throws MethodInvocationException	 *             in case something wrong happenned	 */	public Object execute(Object component) throws MethodInvocationException {		return this.method.invoke(component);	}	/**	 * @return Returns the key.	 */	public String getKey() {		return this.key;	}}

⌨️ 快捷键说明

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