org.apache.struts.action
クラス ActionMessages

java.lang.Object
  拡張org.apache.struts.action.ActionMessages
すべての実装インタフェース:
java.io.Serializable
直系の既知のサブクラス:
ActionErrors

public class ActionMessages
extends java.lang.Object
implements java.io.Serializable

メッセージをカプセル化したクラスです。 メッセージはグローバル、 または指定どちらかの特別なBeanプロパティとなることができます。

A class that encapsulates messages. Messages can be either global or they are specific to a particular bean property.

それぞれ特定のメッセージは、 ActionMessageオブジェクトにより記述されます。 このオブジェクトはメッセージキーを含みます。 (メッセージキーは、適切なメッセージリソースデータベースを調べるためです。) そして、 4つまでのプレースホルダー引数が結果のメッセージの置換変数として使用されます。

Each individual message is described by an ActionMessage object, which contains a message key (to be looked up in an appropriate message resources database), and up to four placeholder arguments used for parametric substitution in the resulting message.

実装上の注意 - これらのオブジェクトは、 シングルスレッドコンテキストの中でのみ生成され扱われることを想定しています。 従いまして、内部コレクションへのアクセスは同期化されていません。

IMPLEMENTATION NOTE - It is assumed that these objects are created and manipulated only within the context of a single thread. Therefore, no synchronization is required for access to internal collections.

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

入れ子クラスの概要
protected  class ActionMessages.ActionMessageItem
          プロパティ/キーとリストに最初に追加する位置に関連付けられたメッセージのセットを登録するため、 このクラスは使われます。
 
フィールドの概要
protected  boolean accessed
          このオブジェクトに関連付けられたメッセージを持つかのboolean。
private static java.util.Comparator actionItemComparator
          アクションメッセージアイテムオブジェクトを比較します。
static java.lang.String GLOBAL_MESSAGE
          特定のプロパティと関連付けられたものとは対照的に、 グローバルメッセージを使用するための"プロパティ名"の文字列。
protected  int iCount
          加算されたプロパティ/キーの最新の数値。
protected  java.util.HashMap messages
          それぞれのプロパティでプロパティ名をキーとした、 (ArrayListに代表される)ActionMessageオブジェクトの累積されたセット。
 
コンストラクタの概要
ActionMessages()
          空のActionMessagesオブジェクトを生成します。
ActionMessages(ActionMessages messages)
          与えられたメッセージで初期化されたActionMessagesオブジェクトを生成します。
 
メソッドの概要
 void add(ActionMessages messages)
          このメッセージのセットに与えられたActionMessagesオブジェクトからメッセージを追加します。
 void add(java.lang.String property, ActionMessage message)
          指定されたプロパティでメッセージのセットにメッセージを追加します。
 void clear()
          このオブジェクトにより登録されている全てのメッセージを消去します。
 java.util.Iterator get()
          メッセージに関連付けられたプロパティにより区別することなく、 登録されている全てのメッセージを返します。
 java.util.Iterator get(java.lang.String property)
          指定されたプロパティに関連付けられたメッセージのセットを返します。
 boolean isAccessed()
          get()またはget(String)メソッドが呼ばれている場合、 trueを返します。
 boolean isEmpty()
          このコレクションにメッセージが登録されていない場合、 trueを返します。
 java.util.Iterator properties()
          少なくとも1つ以上登録されているプロパティ名のセットを返します。
 int size()
          (グローバルメッセージを含む)全てのプロパティに登録されたメッセージの数を返します。
 int size(java.lang.String property)
          指定されたプロパティに関連付けられたメッセージの数を返します。
 java.lang.String toString()
          このアクションメッセージのプロパティ名=メッセージリストのマップを表わす文字列を返します。
 
クラス java.lang.Object から継承したメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

フィールドの詳細

actionItemComparator

private static final java.util.Comparator actionItemComparator

アクションメッセージアイテムオブジェクトを比較します。

Compares ActionMessageItem objects.


GLOBAL_MESSAGE

public static final java.lang.String GLOBAL_MESSAGE

特定のプロパティと関連付けられたものとは対照的に、 グローバルメッセージを使用するための"プロパティ名"の文字列。

The "property name" marker to use for global messages, as opposed to those related to a specific property.

関連項目:
定数フィールド値

accessed

protected boolean accessed

このオブジェクトに関連付けられたメッセージを持つかのboolean。

Have the messages been retrieved from this object?

セッションスコープに格納されたメッセージを削除できるか判断するため、 コントローラはこのプロパティを使用します。

The controller uses this property to determine if session-scoped messages can be removed.

導入されたバージョン:
Struts 1.2

messages

protected java.util.HashMap messages

それぞれのプロパティでプロパティ名をキーとした、 (ArrayListに代表される)ActionMessageオブジェクトの累積されたセット。

The accumulated set of ActionMessage objects (represented as an ArrayList) for each property, keyed by property name.


iCount

protected int iCount

加算されたプロパティ/キーの最新の数値。 この値は加えられたメッセージの順序を維持するために使用されます。

The current number of the property/key being added. This is used to maintain the order messages are added.

コンストラクタの詳細

ActionMessages

public ActionMessages()

空のActionMessagesオブジェクトを生成します。

Create an empty ActionMessages object.


ActionMessages

public ActionMessages(ActionMessages messages)

与えられたメッセージで初期化されたActionMessagesオブジェクトを生成します。

Create an ActionMessages object initialized with the given messages.

パラメータ:
messages - このオブジェクトに最初に加えられるメッセージ このパラメータはnullも可能です。
@param messages The messages to be initially added to this object. This parameter can be null.
導入されたバージョン:
Struts 1.1
メソッドの詳細

add

public void add(java.lang.String property,
                ActionMessage message)

指定されたプロパティでメッセージのセットにメッセージを追加します。 プロパティ/キーの最初に加えられた内容を基に、 プロパティ/キーの順序は維持されます。

Add a message to the set of messages for the specified property. An order of the property/key is maintained based on the initial addition of the property/key.

パラメータ:
property - プロパティ名(またはActionMessages.GLOBAL_MESSAGE)
@param property Property name (or ActionMessages.GLOBAL_MESSAGE)
message - 追加するメッセージ
@param message The message to be added

add

public void add(ActionMessages messages)

このメッセージのセットに与えられたActionMessagesオブジェクトからメッセージを追加します。 メッセージはpropertiesメソッドで返された順序の中に追加されます。 メッセージのプロパティが最新のActionMessagesオブジェクト既に存在する場合、 プロパティのためのリストの最後に追加されます。 メッセージのプロパティが最新のリストに無い場合、 プロパティの最後に追加されます。

Adds the messages from the given ActionMessages object to this set of messages. The messages are added in the order they are returned from the properties method. If a message's property is already in the current ActionMessages object, it is added to the end of the list for that property. If a message's property is not in the current list it is added to the end of the properties.

パラメータ:
messages - 追加されるActionMessagesオブジェクト このパラメータはnullも可能です。
@param messages The ActionMessages object to be added. This parameter can be null.
導入されたバージョン:
Struts 1.1

clear

public void clear()

このオブジェクトにより登録されている全てのメッセージを消去します。

Clear all messages recorded by this object.


isEmpty

public boolean isEmpty()

このコレクションにメッセージが登録されていない場合、 trueを返します。 それ以外の場合、 falseを返します。

Return true if there are no messages recorded in this collection, or false otherwise.

導入されたバージョン:
Struts 1.1

get

public java.util.Iterator get()

メッセージに関連付けられたプロパティにより区別することなく、 登録されている全てのメッセージを返します。 メッセージが登録されたいない場合、 空のリストを返します。

Return the set of all recorded messages, without distinction by which property the messages are associated with. If there are no messages recorded, an empty enumeration is returned.


get

public java.util.Iterator get(java.lang.String property)

指定されたプロパティに関連付けられたメッセージのセットを返します。 そのようなメッセージが無い場合、 空のリストを返します。

Return the set of messages related to a specific property. If there are no such messages, an empty enumeration is returned.

パラメータ:
property - プロパティ名(またはActionMessages.GLOBAL_MESSAGE)
@param property Property name (or ActionMessages.GLOBAL_MESSAGE)

isAccessed

public boolean isAccessed()

get()またはget(String)メソッドが呼ばれている場合、 trueを返します。

Returns true if the get() or get(String) methods are called.

戻り値:
true メッセージが1回以上アクセスされている場合
@return true if the messages have been accessed one or more times.
導入されたバージョン:
Struts 1.2

properties

public java.util.Iterator properties()

少なくとも1つ以上登録されているプロパティ名のセットを返します。 メッセージが無い場合、 空のIteratorを返します。 グローバルメッセージを登録している場合、 ActionMessages.GLOBAL_MESSAGEString値が返されるプロパティ名の1つとなります。

Return the set of property names for which at least one message has been recorded. If there are no messages, an empty Iterator is returned. If you have recorded global messages, the String value of ActionMessages.GLOBAL_MESSAGE will be one of the returned property names.


size

public int size()

(グローバルメッセージを含む)全てのプロパティに登録されたメッセージの数を返します。 注意 - メッセージの有無に関心がある場合、 isEmptyを使用する方が効果的です。

Return the number of messages recorded for all properties (including global messages). NOTE - it is more efficient to call isEmpty if all you care about is whether or not there are any messages at all.


size

public int size(java.lang.String property)

指定されたプロパティに関連付けられたメッセージの数を返します。

Return the number of messages associated with the specified property.

パラメータ:
property - プロパティ名(またはActionMessages.GLOBAL_MESSAGE)
@param property Property name (or ActionMessages.GLOBAL_MESSAGE)

toString

public java.lang.String toString()

このアクションメッセージのプロパティ名=メッセージリストのマップを表わす文字列を返します。

Returns a String representation of this ActionMessages' property name=message list mapping.

関連項目:
Object.toString()


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