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.validator; 18 19 import java.util.Collection; 20 import java.util.Map; 21 22 import org.seasar.cubby.action.ActionErrors; 23 import org.seasar.cubby.action.ActionResult; 24 25 /** 26 * アクションメソッドに対する入力検証のルールの集合です。 27 * 28 * @author agata 29 * @author baba 30 */ 31 public interface ValidationRules { 32 33 /** 34 * すべてのフェーズに対する入力検証を実行します。 35 * 36 * @param params 37 * 要求パラメータ 38 * @param formBean 39 * フォームオブジェクト 40 * @param actionErrors 41 * アクションのエラー 42 */ 43 void validate(Map<String, Object[]> params, Object formBean, 44 ActionErrors actionErrors); 45 46 /** 47 * 入力検証にエラーがあった場合に呼び出されます。 48 * 49 * @param errorPage 50 * エラーページ 51 * @return アクションメソッド実行後の処理 52 * @see org.seasar.cubby.action.Validation#errorPage() 53 */ 54 ActionResult fail(String errorPage); 55 56 /** 57 * 入力検証のフェーズの一覧を実行順に並べた{@link Collection}として取得します。 58 * 59 * @return 入力検証のフェーズ 60 */ 61 Collection<ValidationPhase> getValidationPhases(); 62 63 /** 64 * 指定された入力検証フェーズに対応する入力検証ルールの{@link Collection}を取得します。 65 * 66 * @param validationPhase 67 * 入力検証フェーズ 68 * @return 指定された入力検証フェーズに対応する入力検証ルールの{@link Collection} 69 */ 70 Collection<ValidationRule> getPhaseValidationRules( 71 ValidationPhase validationPhase); 72 73 }