Commits

Takumi IINO  committed 7676798

rename

  • Participants
  • Parent commits b2c268a

Comments (0)

Files changed (2)

File sastruts-oreo/src/main/java/jp/troter/seasar/struts/proxy/ActionAroundMethodProxy.java

+package jp.troter.seasar.struts.proxy;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
+
+import jp.ardito.seasar.struts.proxy.ActionProxy;
+import jp.ardito.seasar.struts.proxy.ProxyChain;
+import jp.troter.seasar.struts.annotation.AfterExecute;
+import jp.troter.seasar.struts.annotation.BeforeExecute;
+
+import org.seasar.framework.util.MethodUtil;
+import org.seasar.framework.util.ModifierUtil;
+import org.seasar.struts.util.S2ActionMappingUtil;
+
+/**
+ * ActionのExecuteメソッドの前後にActionのメソッドを呼び出します。
+ *
+ * Action毎やActionのグループ毎に共通の処理をExecuteメソッドの前後に呼び出します。
+ */
+public class ActionAroundMethodProxy implements ActionProxy {
+
+    @Override
+    public String execute(ProxyChain proxyChain) throws Exception {
+        Object action = S2ActionMappingUtil.getActionMapping().getAction();
+
+        // 前処理
+        String preResult = invokeAroundMethod(action, BeforeExecute.class);
+        if (preResult != null) {
+            return preResult;
+        }
+
+        String result = proxyChain.invoke();
+
+        // 後処理
+        String postResult = invokeAroundMethod(action, AfterExecute.class);
+        if (postResult != null) {
+            return postResult;
+        }
+
+        return result;
+    }
+
+    /**
+     * 実行結果を返す
+     * @param action
+     * @param annotationClass
+     * @return
+     */
+    public String invokeAroundMethod(Object action, Class<? extends Annotation> annotationClass) {
+        Class<?> actionClass = action.getClass();
+        for (Class<?> clazz = actionClass; clazz != Object.class; clazz = clazz.getSuperclass()) {
+            for (Method m : clazz.getDeclaredMethods()) {
+                if (!ModifierUtil.isPublic(m)) {
+                    continue;
+                }
+                if (m.getAnnotation(annotationClass) != null) {
+                    Object result = MethodUtil.invoke(m, action, new Object[]{});
+                    if (result == null) {
+                        return null;
+                    }
+                    return result.toString();
+                }
+            }
+        }
+        return null;
+    }
+}

File sastruts-oreo/src/main/java/jp/troter/seasar/struts/proxy/AroundMethodProxy.java

-package jp.troter.seasar.struts.proxy;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Method;
-
-import jp.ardito.seasar.struts.proxy.ActionProxy;
-import jp.ardito.seasar.struts.proxy.ProxyChain;
-import jp.troter.seasar.struts.annotation.AfterExecute;
-import jp.troter.seasar.struts.annotation.BeforeExecute;
-
-import org.seasar.framework.util.MethodUtil;
-import org.seasar.framework.util.ModifierUtil;
-import org.seasar.struts.util.S2ActionMappingUtil;
-
-/**
- * ActionのExecuteメソッドの前後にActionのメソッドを呼び出します。
- *
- * Action毎やActionのグループ毎に共通の処理をExecuteメソッドの前後に呼び出します。
- */
-public class AroundMethodProxy implements ActionProxy {
-
-    @Override
-    public String execute(ProxyChain proxyChain) throws Exception {
-        Object action = S2ActionMappingUtil.getActionMapping().getAction();
-
-        // 前処理
-        String preResult = invokeAroundMethod(action, BeforeExecute.class);
-        if (preResult != null) {
-            return preResult;
-        }
-
-        String result = proxyChain.invoke();
-
-        // 後処理
-        String postResult = invokeAroundMethod(action, AfterExecute.class);
-        if (postResult != null) {
-            return postResult;
-        }
-
-        return result;
-    }
-
-    /**
-     * 実行結果を返す
-     * @param action
-     * @param annotationClass
-     * @return
-     */
-    public String invokeAroundMethod(Object action, Class<? extends Annotation> annotationClass) {
-        Class<?> actionClass = action.getClass();
-        for (Class<?> clazz = actionClass; clazz != Object.class; clazz = clazz.getSuperclass()) {
-            for (Method m : clazz.getDeclaredMethods()) {
-                if (!ModifierUtil.isPublic(m)) {
-                    continue;
-                }
-                if (m.getAnnotation(annotationClass) != null) {
-                    Object result = MethodUtil.invoke(m, action, new Object[]{});
-                    if (result == null) {
-                        return null;
-                    }
-                    return result.toString();
-                }
-            }
-        }
-        return null;
-    }
-}