org.apache.struts.action
クラス DynaActionForm

java.lang.Object
  拡張org.apache.struts.action.ActionForm
      拡張org.apache.struts.action.DynaActionForm
すべての実装インタフェース:
org.apache.commons.beanutils.DynaBean, java.io.Serializable
直系の既知のサブクラス:
DynaValidatorForm

public class DynaActionForm
extends ActionForm
implements org.apache.commons.beanutils.DynaBean

開発者がフォームBean毎にJavaクラスを作ること無しに、 プロパティの動的なセットを持ったフォームBeanの生成を可能にするActionFormの特殊なサブクラスです。

Specialized subclass of ActionForm that allows the creation of form beans with dynamic sets of properties, without requiring the developer to create a Java class for each type of form bean.

使用上の注意 - Struts 1.1以降、 resetメソッドは、 Struts設定ファイルの<form-property>要素で指定された値にプロパティを初期化するメソッドではありません。 もしこのような初期化を行いたいならば、 DynaActionFormをサブクラス化してその中でinitializeメソッドを使用することが最もシンプルな解決策となります。

USAGE NOTE - Since Struts 1.1, the reset method no longer initializes property values to those specified in <form-property> elements in the Struts module configuration file. If you wish to utilize that behavior, the simplest solution is to subclass DynaActionForm and call the initialize method inside it.

導入されたバージョン:
Struts 1.1
バージョン:
$Revision: 1.6 $ $Date: 2005/05/09 13:23:57 $
関連項目:
直列化された形式
翻訳者:
棚澤 昌幸
翻訳状況:
初稿(校正者募集中)

フィールドの概要
protected  DynaActionFormClass dynaClass
          関連付けられたDynaActionFormClass
protected  java.util.HashMap dynaValues
          プロパティ名をキーとした、 このDynaActionFormに対するプロパティ値のセット。
 
クラス org.apache.struts.action.ActionForm から継承したフィールド
multipartRequestHandler, servlet
 
コンストラクタの概要
DynaActionForm()
           
 
メソッドの概要
 boolean contains(java.lang.String name, java.lang.String key)
          指定されたマップであるプロパティが指定されたキー値を保持しているか知らせます。
 java.lang.Object get(java.lang.String name)
          指定された名前を持ったシンプルなプロパティの値を返します。
 java.lang.Object get(java.lang.String name, int index)
          指定された名前のインデックス付きプロパティの値を返します。
 java.lang.Object get(java.lang.String name, java.lang.String key)
          指定された名前のマップであるプロパティの値を返します。
 org.apache.commons.beanutils.DynaClass getDynaClass()
          このDynaBeanで利用できるプロパティのセットである DynaClassインスタンスを返します。
protected  org.apache.commons.beanutils.DynaProperty getDynaProperty(java.lang.String name)
          指定されたプロパティのプロパティ記述子を返します。
 java.util.Map getMap()
          プロパティの値をもつMapを返します。
 java.lang.String getString(java.lang.String name)
          指定された名前のString型プロパティの値を返します。
 java.lang.String[] getStrings(java.lang.String name)
          指定された名前のString[]型プロパティの値を返します。
 void initialize(ActionMapping mapping)
          このDynaActionFormの定義に関連付けられたFormPropertyConfig要素の中で指定された初期値に、 全てのBeanプロパティの値を初期化します。
 void initialize(FormBeanConfig config)
           
protected  boolean isDynaAssignable(java.lang.Class dest, java.lang.Class source)
          ソースクラスのオブジェクトに目的のクラスが割り当てられているか示します。
 void remove(java.lang.String name, java.lang.String key)
          指定されたマップであるプロパティの指定されたキーに対して存在する値を削除します。
 void reset(ActionMapping mapping, javax.servlet.http.HttpServletRequest request)
          必要に応じて、 デフォルト状態にbeanのプロパティをリセットします。
 void reset(ActionMapping mapping, javax.servlet.ServletRequest request)
          必要に応じて、 デフォルト状態にBeanのプロパティをリセットします。
 void set(java.lang.String name, int index, java.lang.Object value)
          指定された名前のインデックス付きプロパティの値を設定します。
 void set(java.lang.String name, java.lang.Object value)
          指定された名前のシンプルなプロパティの値を設定します。
 void set(java.lang.String name, java.lang.String key, java.lang.Object value)
          指定された名前のマップであるプロパティの値を設定します。
(パッケージプライベート)  void setDynaActionFormClass(DynaActionFormClass dynaClass)
          関連付けられたDynaActionFormClassインスタンスを設定します。
 java.lang.String toString()
          このオブジェクトの内容を文字列として書き出します。
 
クラス org.apache.struts.action.ActionForm から継承したメソッド
getMultipartRequestHandler, getServlet, getServletWrapper, setMultipartRequestHandler, setServlet, validate, validate
 
クラス java.lang.Object から継承したメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

フィールドの詳細

dynaClass

protected DynaActionFormClass dynaClass

関連付けられたDynaActionFormClass

The DynaActionFormClass with which we are associated.


dynaValues

protected java.util.HashMap dynaValues

プロパティ名をキーとした、 このDynaActionFormに対するプロパティ値のセット。

The set of property values for this DynaActionForm, keyed by property name.

コンストラクタの詳細

DynaActionForm

public DynaActionForm()
メソッドの詳細

initialize

public void initialize(ActionMapping mapping)

このDynaActionFormの定義に関連付けられたFormPropertyConfig要素の中で指定された初期値に、 全てのBeanプロパティの値を初期化します。

Initialize all bean properties to their initial values, as specified in the {@link FormPropertyConfig} elements associated with the definition of this DynaActionForm.

パラメータ:
mapping - このインスタンスを選択するために用いられたマッピング
@param mapping The mapping used to select this instance

initialize

public void initialize(FormBeanConfig config)

reset

public void reset(ActionMapping mapping,
                  javax.servlet.ServletRequest request)

必要に応じて、 デフォルト状態にBeanのプロパティをリセットします。 このメソッドはコントローラがプロパティを再設定される前に呼ばれます。

Reset bean properties to their default state, as needed. This method is called before the properties are repopulated by the controller.

デフォルトの実装はこのメソッドのHTTPバージョンにフォワードを試みます。

The default implementation attempts to forward to the HTTP version of this method.

オーバーライド:
クラス ActionForm 内の reset
パラメータ:
mapping - このインスタンスを選択するために用いられたマッピング
@param mapping The mapping used to select this instance
request - 処理しているServletリクエスト
@param request The servlet request we are processing

reset

public void reset(ActionMapping mapping,
                  javax.servlet.http.HttpServletRequest request)

必要に応じて、 デフォルト状態にbeanのプロパティをリセットします。 このメソッドはコントローラがプロパティを再設定される前に呼ばれます。

Reset bean properties to their default state, as needed. This method is called before the properties are repopulated by the controller.

デフォルトの実装は何もしません(Struts 1.1以降)。 サブクラスはデフォルト値にbeanプロパティをリセットするため、 このメソッドをオーバライドするかも知れません。 または、initializeメソッドが、 フォームプロパティの設定情報で与えられた値にプロパティの値を初期化するために使用されるかも知れません (このメソッドの動作はリリースによります)。

The default implementation (since Struts 1.1) does nothing. Subclasses may override this method to reset bean properties to default values, or the initialize method may be used to initialize property values to those provided in the form property configuration information (which was the behavior of this method in some release candidates).

オーバーライド:
クラス ActionForm 内の reset
パラメータ:
mapping - このインスタンスを選択するために用いられたマッピング
@param mapping The mapping used to select this instance
request - 処理しているServletリクエスト
@param request The servlet request we are processing

contains

public boolean contains(java.lang.String name,
                        java.lang.String key)

指定されたマップであるプロパティが指定されたキー値を保持しているか知らせます。

Indicates if the specified mapped property contain a value for the specified key value.

定義:
インタフェース org.apache.commons.beanutils.DynaBean 内の contains
パラメータ:
name - チェックするプロパティ名
@param name Name of the property to check
key - チェックするキーの名前
@param key Name of the key to check
例外:
java.lang.IllegalArgumentException - 指定された名前のマッププロパティがない場合
@exception IllegalArgumentException if there is no property of the specified name

get

public java.lang.Object get(java.lang.String name)

指定された名前を持ったシンプルなプロパティの値を返します。

[訳者コメント: マップであるプロパティ(mapped property)、 インデックス付きプロパティ(indexed property)との対比であるsimple propertyなので、 シンプルなプロパティ(simple property)としてみました。]

Return the value of a simple property with the specified name.

定義:
インタフェース org.apache.commons.beanutils.DynaBean 内の get
パラメータ:
name - 値を取得するプロパティ名
@param name Name of the property whose value is to be retrieved
例外:
java.lang.IllegalArgumentException - 指定された名前のプロパティがない場合
@exception IllegalArgumentException if there is no property of the specified name
java.lang.NullPointerException - 指定されたプロパティの型が妥当でない場合
@exception NullPointerException if the type specified for the property is invalid

get

public java.lang.Object get(java.lang.String name,
                            int index)

指定された名前のインデックス付きプロパティの値を返します。

Return the value of an indexed property with the specified name.

定義:
インタフェース org.apache.commons.beanutils.DynaBean 内の get
パラメータ:
name - 値を取得するプロパティ名
@param name Name of the property whose value is to be retrieved
index - 取得する値のインデックス値
@param index Index of the value to be retrieved
例外:
java.lang.IllegalArgumentException - 指定された名前のプロパティがない場合
@exception IllegalArgumentException if there is no property of the specified name
java.lang.IllegalArgumentException - 指定されたプロパティは存在しますが、 インデックス付きプロパティでない場合
@exception IllegalArgumentException if the specified property exists, but is not indexed
java.lang.IndexOutOfBoundsException - 指定されたインデックス値がプロパティの範囲外である場合
@exception IndexOutOfBoundsException if the specified index is outside the range of the underlying property
java.lang.NullPointerException - このプロパティに対する初期化された配列またはリストがない場合
@exception NullPointerException if no array or List has been initialized for this property

get

public java.lang.Object get(java.lang.String name,
                            java.lang.String key)

指定された名前のマップであるプロパティの値を返します。 また、指定されたキーの値がない場合はnullを返します。

Return the value of a mapped property with the specified name, or null if there is no value for the specified key.

定義:
インタフェース org.apache.commons.beanutils.DynaBean 内の get
パラメータ:
name - 値を取得するプロパティ名
@param name Name of the property whose value is to be retrieved
key - 取得する値のキー
@param key Key of the value to be retrieved
例外:
java.lang.IllegalArgumentException - 指定された名前のプロパティがない場合
@exception IllegalArgumentException if there is no property of the specified name
java.lang.IllegalArgumentException - 指定されたプロパティは存在しますが、 マップであるプロパティでない場合
@exception IllegalArgumentException if the specified property exists, but is not mapped

getString

public java.lang.String getString(java.lang.String name)

指定された名前のString型プロパティの値を返します。 これは、(String) dynaForm.get(name)を呼ぶことに相当します。

Return the value of a String property with the specified name. This is equivalent to calling (String) dynaForm.get(name).

パラメータ:
name - 値を取得するプロパティ名
@param name Name of the property whose value is to be retrieved
例外:
java.lang.IllegalArgumentException - 指定された名前のプロパティがない場合
@throws IllegalArgumentException if there is no property of the specified name
java.lang.NullPointerException - 指定されたプロパティの型が妥当でない場合
@throws NullPointerException if the type specified for the property is invalid
java.lang.ClassCastException - プロパティがString型でない場合
@throws ClassCastException if the property is not a String.
導入されたバージョン:
Struts 1.2

getStrings

public java.lang.String[] getStrings(java.lang.String name)

指定された名前のString[]型プロパティの値を返します。 これは、(String[]) dynaForm.get(name)を呼ぶことに相当します。

Return the value of a String[] property with the specified name. This is equivalent to calling (String[]) dynaForm.get(name).

パラメータ:
name - 値を取得するプロパティ名
@param name Name of the property whose value is to be retrieved
例外:
java.lang.IllegalArgumentException - 指定された名前のプロパティがない場合
@throws IllegalArgumentException if there is no property of the specified name
java.lang.NullPointerException - 指定されたプロパティの型が妥当でない場合
@throws NullPointerException if the type specified for the property is invalid
java.lang.ClassCastException - プロパティがString[]型でない場合
@throws ClassCastException if the property is not a String[].
導入されたバージョン:
Struts 1.2

getDynaClass

public org.apache.commons.beanutils.DynaClass getDynaClass()

このDynaBeanで利用できるプロパティのセットである DynaClassインスタンスを返します。

Return the DynaClass instance that describes the set of properties available for this DynaBean.

定義:
インタフェース org.apache.commons.beanutils.DynaBean 内の getDynaClass

getMap

public java.util.Map getMap()

プロパティの値をもつMapを返します。 JavaBeansのアクセッサを通してDynaActionFormにアクセスすることを楽にします。 これは、主にJavaサーバページのスタンダードタグライブラリ(JSTL)を使用するためです。

Returns the Map containing the property values. This is done mostly to facilitate accessing the DynaActionForm through JavaBeans accessors, in order to use the JavaServer Pages Standard Tag Library (JSTL).

例えば、 ActionFormにアクセスするための一般的なJSTL ELシンタックスは次のようになります。:

 ${formbean.prop}
DynaActionFormにアクセスするためのJSTL ELシンタックスは次のようになります。 (getMap()メソッドのためです。):
  ${dynabean.map.prop}

For instance, the normal JSTL EL syntax for accessing an ActionForm would be something like this:

  ${formbean.prop
The JSTL EL syntax for accessing a DynaActionForm looks something like this (because of the presence of this getMap() method):
  ${dynabean.map.prop}

}


remove

public void remove(java.lang.String name,
                   java.lang.String key)

指定されたマップであるプロパティの指定されたキーに対して存在する値を削除します。

Remove any existing value for the specified key on the specified mapped property.

定義:
インタフェース org.apache.commons.beanutils.DynaBean 内の remove
パラメータ:
name - 値を削除するプロパティの名前
@param name Name of the property for which a value is to be removed
key - 削除する値のキー
@param key Key of the value to be removed
例外:
java.lang.IllegalArgumentException - 指定された名前のプロパティがない場合
@exception IllegalArgumentException if there is no property of the specified name

set

public void set(java.lang.String name,
                java.lang.Object value)

指定された名前のシンプルなプロパティの値を設定します。

Set the value of a simple property with the specified name.

定義:
インタフェース org.apache.commons.beanutils.DynaBean 内の set
パラメータ:
name - 値を設定するプロパティの名前
@param name Name of the property whose value is to be set
value - プロパティに設定する値
@param value Value to which this property is to be set
例外:
org.apache.commons.beanutils.ConversionException - 指定された値がプロパティに要求される型に変換できない場合
@exception ConversionException if the specified value cannot be converted to the type required for this property
java.lang.IllegalArgumentException - 指定された名前のプロパティがない場合
@exception IllegalArgumentException if there is no property of the specified name
java.lang.NullPointerException - 指定されたプロパティの型が妥当でない場合
@exception NullPointerException if the type specified for the property is invalid
java.lang.NullPointerException - プリミティブ型にnullを設定しようと試みた場合
@exception NullPointerException if an attempt is made to set a primitive property to null

set

public void set(java.lang.String name,
                int index,
                java.lang.Object value)

指定された名前のインデックス付きプロパティの値を設定します。

Set the value of an indexed property with the specified name.

定義:
インタフェース org.apache.commons.beanutils.DynaBean 内の set
パラメータ:
name - 値を設定するプロパティの名前
@param name Name of the property whose value is to be set
index - 設定するプロパティのインデックス
@param index Index of the property to be set
value - 設定するプロパティの値
@param value Value to which this property is to be set
例外:
org.apache.commons.beanutils.ConversionException - 指定された値がプロパティに要求される型に変換できない場合
@exception ConversionException if the specified value cannot be converted to the type required for this property
java.lang.IllegalArgumentException - 指定された名前のプロパティがない場合
@exception IllegalArgumentException if there is no property of the specified name
java.lang.IllegalArgumentException - 指定されたプロパティは存在しますが、 インデックス付きプロパティでない場合
@exception IllegalArgumentException if the specified property exists, but is not indexed
java.lang.IndexOutOfBoundsException - 指定されたインデックス値がプロパティの範囲外である場合
@exception IndexOutOfBoundsException if the specified index is outside the range of the underlying property

set

public void set(java.lang.String name,
                java.lang.String key,
                java.lang.Object value)

指定された名前のマップであるプロパティの値を設定します。

Set the value of a mapped property with the specified name.

定義:
インタフェース org.apache.commons.beanutils.DynaBean 内の set
パラメータ:
name - 値を設定するプロパティの名前
@param name Name of the property whose value is to be set
key - 設定するプロパティのキー
@param key Key of the property to be set
value - 設定するプロパティの値
@param value Value to which this property is to be set
例外:
org.apache.commons.beanutils.ConversionException - 指定された値がプロパティに要求される型に変換できない場合
@exception ConversionException if the specified value cannot be converted to the type required for this property
java.lang.IllegalArgumentException - 指定された名前のプロパティがない場合
@exception IllegalArgumentException if there is no property of the specified name
java.lang.IllegalArgumentException - 指定されたプロパティは存在しますが、 マップであるプロパティでない場合
@exception IllegalArgumentException if the specified property exists, but is not mapped

toString

public java.lang.String toString()

このオブジェクトの内容を文字列として書き出します。

Render a String representation of this object.


setDynaActionFormClass

void setDynaActionFormClass(DynaActionFormClass dynaClass)

関連付けられたDynaActionFormClassインスタンスを設定します。

Set the DynaActionFormClass instance with which we are associated.

パラメータ:
dynaClass - このbeanに対するDynaActionFormClassインスタンス
@param dynaClass The DynaActionFormClass instance for this bean

getDynaProperty

protected org.apache.commons.beanutils.DynaProperty getDynaProperty(java.lang.String name)

指定されたプロパティのプロパティ記述子を返します。

Return the property descriptor for the specified property name.

パラメータ:
name - 記述子を取得するプロパティの名前
@param name Name of the property for which to retrieve the descriptor
例外:
java.lang.IllegalArgumentException - DynaClassに対するプロパティの名前が妥当でない場合
@exception IllegalArgumentException if this is not a valid property name for our DynaClass

isDynaAssignable

protected boolean isDynaAssignable(java.lang.Class dest,
                                   java.lang.Class source)

ソースクラスのオブジェクトに目的のクラスが割り当てられているか示します。

Indicates if an object of the source class is assignable to the destination class.

パラメータ:
dest - 目的のクラス
@param dest Destination class
source - ソースクラス
@param source Source class


このドキュメントは、Ja-Jakartaにより訳されました。コメントがある場合は、report@jajakarta.orgまでお願いします。
Copyright (C) 2000-2004 - Apache Software Foundation