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