View Javadoc

1   /*
2    * Copyright 2004-2008 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.validator;
17  
18  import java.util.Collection;
19  import java.util.List;
20  
21  import org.seasar.cubby.action.ActionResult;
22  
23  /**
24   * アクションメソッドに対する入力検証のルールの集合です。
25   * 
26   * @author agata
27   * @author baba
28   * @since 1.0.0
29   */
30  public interface ValidationRules {
31  
32  	/**
33  	 * 入力検証ルールのリストを取得します。
34  	 * 
35  	 * @return 入力検証ルールのリスト
36  	 * @deprecated {@link DefaultValidationRules#addAll(ValidationRules)} を使用してください。
37  	 */
38  	@Deprecated
39  	List<ValidationRule> getRules();
40  
41  	/**
42  	 * 入力検証にエラーがあった場合に呼び出されます。
43  	 * 
44  	 * @param errorPage
45  	 *            エラーページ
46  	 * @return アクションメソッド実行後の処理
47  	 * @see org.seasar.cubby.action.Validation#errorPage()
48  	 * @since 1.0.2
49  	 */
50  	ActionResult fail(String errorPage);
51  
52  	/**
53  	 * 入力検証のフェーズの一覧を実行順に並べた{@link Collection}として取得します。
54  	 * 
55  	 * @return 入力検証のフェーズ
56  	 * @since 1.1.0
57  	 */
58  	Collection<ValidationPhase> getValidationPhases();
59  
60  	/**
61  	 * 指定された入力検証フェーズに対応する入力検証ルールの{@link Collection}を取得します。
62  	 * 
63  	 * @param validationPhase
64  	 *            入力検証フェーズ
65  	 * @return 指定された入力検証フェーズに対応する入力検証ルールの{@link Collection}
66  	 * @since 1.1.0
67  	 */
68  	Collection<ValidationRule> getPhaseValidationRules(
69  			ValidationPhase validationPhase);
70  
71  }