View Javadoc

1   /*
2    * Copyright 2004-2010 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  
17  package org.seasar.cubby.action;
18  
19  import java.util.List;
20  import java.util.Map;
21  
22  /**
23   * アクションで発生したエラーを保持するクラス。
24   * 
25   * @author agata
26   * @author baba
27   */
28  public interface ActionErrors {
29  	/**
30  	 * エラーが存在しないかどうかを判定します。
31  	 * 
32  	 * @return エラーが存在しなければtrue
33  	 */
34  	boolean isEmpty();
35  
36  	/**
37  	 * メッセージを追加します。
38  	 * 
39  	 * @param message
40  	 *            メッセージ
41  	 */
42  	void add(String message);
43  
44  	/**
45  	 * メッセージを追加します。
46  	 * 
47  	 * @param message
48  	 *            メッセージ
49  	 * @param fieldInfo
50  	 *            フィールド情報
51  	 */
52  	void add(String message, FieldInfo... fieldInfo);
53  
54  	/**
55  	 * メッセージを追加します。
56  	 * 
57  	 * @param message
58  	 *            メッセージ
59  	 * @param fieldNames
60  	 *            フィールド名
61  	 */
62  	void add(String message, String... fieldNames);
63  
64  	/**
65  	 * アクションで発生した全てのエラーの一覧を取得します。
66  	 * 
67  	 * @return アクションで発生した全てのエラーの一覧
68  	 */
69  	List<String> getAll();
70  
71  	/**
72  	 * フィールドで発生したエラーの一覧を取得します。
73  	 * 
74  	 * @return フィールドで発生したエラーの一覧
75  	 */
76  	Map<String, List<String>> getFields();
77  
78  	/**
79  	 * インデックス付きフィールドで発生したエラーの一覧を取得します。
80  	 * 
81  	 * @return インデックス付きフィールドで発生したエラーの一覧
82  	 */
83  	Map<String, Map<Integer, List<String>>> getIndexedFields();
84  
85  	/**
86  	 * フィールド以外で発生したエラーの一覧を取得します。
87  	 * 
88  	 * @return フィールド以外で発生したエラーの一覧
89  	 */
90  	List<String> getOthers();
91  
92  	/**
93  	 * エラーをクリアします。
94  	 */
95  	void clear();
96  
97  }