KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > cocoon > forms > datatype > ValidationRule


1 /*
2  * Copyright 1999-2004 The Apache Software Foundation.
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, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.apache.cocoon.forms.datatype;
17
18 import org.apache.cocoon.forms.validation.ValidationError;
19 import org.outerj.expression.ExpressionContext;
20
21 /**
22  * Interface for validation rules. Most {@link Datatype} implementations will
23  * perform their validation by checking a number of these validation rules
24  * (though strictly spoken this is not required).
25  *
26  * @version $Id: ValidationRule.java 56582 2004-11-04 10:16:22Z sylvain $
27  */

28 public interface ValidationRule {
29     /**
30      *
31      * @param value a value of a class supported by the ValidationRule implementation
32      * @param expressionContext many validation rules use the xReporter expression interpreter,
33      * the expressionContext allows to resolve variables used in these expressions.
34      */

35     ValidationError validate(Object JavaDoc value, ExpressionContext expressionContext);
36
37     /**
38      * Returns true if this ValidationRule supports validating objects of the same class
39      * as the one specified. If the flag 'arrayType' is true, this method will return true
40      * if this validation rule can validate arrays of these objects (i.e. the object passed
41      * to the validate method will then be an array).
42      */

43     boolean supportsType(Class JavaDoc clazz, boolean arrayType);
44 }
45
Popular Tags