浏览代码

jfinal 3.6

James 7 年之前
父节点
当前提交
f7a73c2d10
共有 1 个文件被更改,包括 16 次插入3 次删除
  1. 16 3
      src/main/java/com/jfinal/aop/AopFactory.java

+ 16 - 3
src/main/java/com/jfinal/aop/AopFactory.java

@@ -88,9 +88,22 @@ public class AopFactory {
 	}
 	
 	// 方法原型的参数测试过可以是:Class<? super T> targetClass, T targetObject
-	public <T> T inject(Class<T> targetClass, T targetObject) throws ReflectiveOperationException {
-		doInject(targetClass, targetObject, injectDepth);
-		return targetObject;
+	public <T> T inject(Class<T> targetClass, T targetObject) {
+		try {
+			doInject(targetClass, targetObject, injectDepth);
+			return targetObject;
+		} catch (ReflectiveOperationException e) {
+			throw new RuntimeException(e);
+		}
+	}
+	
+	public <T> T inject(Class<T> targetClass, T targetObject, int injectDepth) {
+		try {
+			doInject(targetClass, targetObject, injectDepth);
+			return targetObject;
+		} catch (ReflectiveOperationException e) {
+			throw new RuntimeException(e);
+		}
 	}
 	
 	protected void doInject(Class<?> targetClass, Object targetObject, int injectDepth) throws ReflectiveOperationException {