Woolpack API

woolpack.action
クラス ActionInvoker

java.lang.Object
  上位を拡張 woolpack.action.ActionInvoker

public class ActionInvoker
extends java.lang.Object

アクションを実行するクラスです。 invoke(Object, String, Map)メソッドは、 アクションidに対するアクション定義を検索し、 root からActionDef.getComponentEL()でコンポーネントを取得し、 inputMap の値をコンポーネントに設定し、 root のメソッドActionDef.getMethodEL()を実行し、 実行結果にマッチする遷移先定義をActionDef.getForwardDefIterable()から検索します。 アクション定義に遷移先定義が見つからない場合、 コンストラクタ引数のForwardDefの一覧から遷移先定義を検索します。
適用しているデザインパターン:Template Method。

作成者:
nakamura

コンストラクタの概要
ActionInvoker(Fn<java.lang.String,ActionDef,java.lang.RuntimeException> switching, ForwardDef... array)
           
ActionInvoker(Fn<java.lang.String,ActionDef,java.lang.RuntimeException> switching, java.lang.Iterable<ForwardDef> iterable)
           
 
メソッドの概要
static ActionResult findId(java.lang.Iterable<ForwardDef> iterable, java.lang.Object aReturnedObject)
          遷移先定義を検索して実行結果を返します。
 java.lang.Iterable<ForwardDef> getIterable()
           
 Fn<java.lang.String,ActionDef,java.lang.RuntimeException> getSwitching()
           
protected  void handleRuntimeException(java.lang.RuntimeException exception)
          setValuesTo(Object, Map, ActionInvoker)が失敗した際に呼び出されます(called)。
 ActionResult invoke(java.lang.Object root, java.lang.String id, java.util.Map inputMap)
          アクションを実行します。
 void setIterable(java.lang.Iterable<ForwardDef> iterable)
           
 void setSwitching(Fn<java.lang.String,ActionDef,java.lang.RuntimeException> switching)
           
static void setValuesTo(java.lang.Object root, java.util.Map inputMap, ActionInvoker invoker)
          inputMap の値を root に設定します。
 
クラス java.lang.Object から継承されたメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

コンストラクタの詳細

ActionInvoker

public ActionInvoker(Fn<java.lang.String,ActionDef,java.lang.RuntimeException> switching,
                     java.lang.Iterable<ForwardDef> iterable)
パラメータ:
switching - アクション id とアクション定義の対応表。
iterable - 遷移先定義の一覧。

ActionInvoker

public ActionInvoker(Fn<java.lang.String,ActionDef,java.lang.RuntimeException> switching,
                     ForwardDef... array)
パラメータ:
switching - アクション id とアクション定義の対応表。
array - 遷移先定義の一覧。
メソッドの詳細

invoke

public ActionResult invoke(java.lang.Object root,
                           java.lang.String id,
                           java.util.Map inputMap)
アクションを実行します。

パラメータ:
root - コンポーネントとメソッド検索の基点。
id - アクション id。
inputMap - 入力値のMap。ServletRequest.getParameterMap() またはそれを ValidatorUtils.convert(Map) で変換した結果が渡されることを想定しています。
戻り値:
実行結果。
例外:
ForwardDefNotFoundRuntimeException - 該当する遷移先定義が見つからない場合。

setValuesTo

public static void setValuesTo(java.lang.Object root,
                               java.util.Map inputMap,
                               ActionInvoker invoker)
inputMap の値を root に設定します。

パラメータ:
root - 基点。null なら設定しません。
inputMap - 設定する値のMap
例外:
java.lang.NullPointerException - inputMap が null の場合。

handleRuntimeException

protected void handleRuntimeException(java.lang.RuntimeException exception)
setValuesTo(Object, Map, ActionInvoker)が失敗した際に呼び出されます(called)。 デフォルトは何もしません。

パラメータ:
exception - setValuesTo(Object, Map, ActionInvoker)が失敗した際のエラーオブジェクト。

findId

public static ActionResult findId(java.lang.Iterable<ForwardDef> iterable,
                                  java.lang.Object aReturnedObject)
遷移先定義を検索して実行結果を返します。

パラメータ:
iterable - 遷移先定義の一覧。
aReturnedObject - メソッドが返却したオブジェクト。
戻り値:
実行結果。
例外:
ForwardDefNotFoundRuntimeException - 該当する遷移先定義が見つからない場合。

getIterable

public java.lang.Iterable<ForwardDef> getIterable()

setIterable

public void setIterable(java.lang.Iterable<ForwardDef> iterable)

getSwitching

public Fn<java.lang.String,ActionDef,java.lang.RuntimeException> getSwitching()

setSwitching

public void setSwitching(Fn<java.lang.String,ActionDef,java.lang.RuntimeException> switching)

Woolpack API

Copyright (C) 2006-2007 Takahiro Nakamura. All rights reserved.