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.io.Serializable;
19  import java.lang.reflect.Method;
20  
21  import org.seasar.cubby.action.Action;
22  import org.seasar.cubby.action.ActionResult;
23  
24  /**
25   * 指定された {@link ActionResult} を実行する {@link ValidationFailBehaviour} です。
26   * 
27   * @author baba
28   * @since 1.1.0
29   */
30  class ActionResultValidationFailBehaviour implements
31  		ValidationFailBehaviour, Serializable {
32  
33  	/** シリアルバージョンUID。 */
34  	private static final long serialVersionUID = 1L;
35  
36  	private final ActionResult actionResult;
37  
38  	/**
39  	 * インスタンス化します。
40  	 * 
41  	 * @param actionResult
42  	 *            入力検証でエラーがあった場合に実行する {@link ActionResult} です。
43  	 */
44  	public ActionResultValidationFailBehaviour(final ActionResult actionResult) {
45  		this.actionResult = actionResult;
46  	}
47  
48  	/**
49  	 * {@inheritDoc}
50  	 */
51  	public ActionResult getActionResult(final Action action, final Method method) {
52  		return actionResult;
53  	}
54  
55  }