View Javadoc

1   /*
2    * Copyright 2004-2009 the Seasar Foundation and the Others.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
13   * either express or implied. See the License for the specific language
14   * governing permissions and limitations under the License.
15   */
16  package org.seasar.cubby.action;
17  
18  import java.util.List;
19  import java.util.Map;
20  
21  /**
22   * アクションで発生したエラーを保持するクラス。
23   * 
24   * @author agata
25   * @author baba
26   */
27  public interface ActionErrors {
28  	/**
29  	 * エラーが存在しないかどうかを判定します。
30  	 * 
31  	 * @return エラーが存在しなければtrue
32  	 */
33  	boolean isEmpty();
34  
35  	/**
36  	 * メッセージを追加します。
37  	 * 
38  	 * @param message
39  	 *            メッセージ
40  	 */
41  	void add(String message);
42  
43  	/**
44  	 * メッセージを追加します。
45  	 * 
46  	 * @param message
47  	 *            メッセージ
48  	 * @param fieldInfo
49  	 *            フィールド情報
50  	 */
51  	void add(String message, FieldInfo... fieldInfo);
52  
53  	/**
54  	 * メッセージを追加します。
55  	 * 
56  	 * @param message
57  	 *            メッセージ
58  	 * @param fieldNames
59  	 *            フィールド名
60  	 */
61  	void add(String message, String... fieldNames);
62  
63  	/**
64  	 * アクションで発生した全てのエラーの一覧を取得します。
65  	 * 
66  	 * @return アクションで発生した全てのエラーの一覧
67  	 */
68  	List<String> getAll();
69  
70  	/**
71  	 * フィールドで発生したエラーの一覧を取得します。
72  	 * 
73  	 * @return フィールドで発生したエラーの一覧
74  	 */
75  	Map<String, List<String>> getFields();
76  
77  	/**
78  	 * インデックス付きフィールドで発生したエラーの一覧を取得します。
79  	 * 
80  	 * @return インデックス付きフィールドで発生したエラーの一覧
81  	 */
82  	Map<String, Map<Integer, List<String>>> getIndexedFields();
83  
84  	/**
85  	 * フィールド以外で発生したエラーの一覧を取得します。
86  	 * 
87  	 * @return フィールド以外で発生したエラーの一覧
88  	 */
89  	List<String> getOthers();
90  
91  	/**
92  	 * エラーをクリアします。
93  	 */
94  	void clear();
95  
96  }