|
|||||||||||||||||||
30 day Evaluation License registered to hlship@comcast.net Your 30 day evaluation period has expired. Please visit http://www.cenqua.com to obtain a licensed version of Clover | |||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
ValidatorFactory.java | - | - | - | - |
|
1 | // Copyright 2005 The Apache Software Foundation | |
2 | // | |
3 | // Licensed under the Apache License, Version 2.0 (the "License"); | |
4 | // you may not use this file except in compliance with the License. | |
5 | // You may obtain a copy of the License at | |
6 | // | |
7 | // http://www.apache.org/licenses/LICENSE-2.0 | |
8 | // | |
9 | // Unless required by applicable law or agreed to in writing, software | |
10 | // distributed under the License is distributed on an "AS IS" BASIS, | |
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
12 | // See the License for the specific language governing permissions and | |
13 | // limitations under the License. | |
14 | ||
15 | package org.apache.tapestry.form.validator; | |
16 | ||
17 | import java.util.List; | |
18 | ||
19 | import org.apache.tapestry.IComponent; | |
20 | ||
21 | /** | |
22 | * Constructs {@link org.apache.tapestry.form.validator.Validator} instances from a specification. A | |
23 | * specification is a comma-seperated list of entries. Each entry is in one of the following forms: | |
24 | * <ul> | |
25 | * <li><em>name</em> | |
26 | * <li><em>name</em>=<em>value</em> | |
27 | * <li><em>name[<em>message</em>]</em> | |
28 | * <li><em>name</em>=<em>value</em>[<em>message</em>] | |
29 | * </ul> | |
30 | * <p> | |
31 | * Most validator classes are <em>configurable</em>: they have a property that matches their | |
32 | * name. For example, {@link org.apache.tapestry.form.validator.MinDate} (which is named "minDate" | |
33 | * has a <code>minDate</code> property. A few validators are not configurable ("required" => | |
34 | * {@link org.apache.tapestry.form.validator.Required}, for example). | |
35 | * <p> | |
36 | * Validators are expected to have a public no-args constructor. They are also expected to have a | |
37 | * <code>message</code> property which is set from the value in brackets. | |
38 | * <p> | |
39 | * A full validator specification might be: | |
40 | * <code>required,email,minLength=20[Email addresses must be at least 20 characters long.] | |
41 | * | |
42 | * @author Howard Lewis Ship | |
43 | * @since 4.0 | |
44 | */ | |
45 | public interface ValidatorFactory | |
46 | { | |
47 | /** | |
48 | * Constructs a new (immutable) List of {@link Validator}, or returns a previously constructed | |
49 | * List. | |
50 | * | |
51 | * @param specification | |
52 | * a string identifying which validators and their configuration | |
53 | * @return List of {@link Validator} (possibly empty) | |
54 | */ | |
55 | public List constructValidatorList(String specification); | |
56 | } |
|