01: /*
02: * Copyright 2004, 2005, 2006 Odysseus Software GmbH
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
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, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16: package de.odysseus.calyxo.forms;
17:
18: import java.util.Locale;
19:
20: import javax.servlet.http.HttpServletRequest;
21:
22: /**
23: * Checker interface.
24: * A checker takes an already matched and converted value and tests it.
25: * Implementors must have an empty constructor. Additionally to the
26: * methods required for a validation engine they have to implement the
27: * {@link #check(HttpServletRequest, Object)} method.
28: *
29: * @author Christoph Beck
30: * @author Oliver Stuhr
31: */
32: public interface Checker extends ValidatorBase {
33: /**
34: * Static "do-nothing" checker instance
35: */
36: public static final Checker TRUE = new Checker() {
37: public boolean check(HttpServletRequest request, Object value) {
38: return true;
39: }
40:
41: public void localize(Locale locale) {
42: }
43:
44: public boolean isSharable() {
45: return true;
46: }
47: };
48:
49: /**
50: * Check the specified value (to be implemented by subclasses)
51: */
52: public boolean check(HttpServletRequest request, Object value);
53: }
|