1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.struts.flow.core.source.impl.validity;
18
19 import org.apache.struts.flow.core.source.SourceValidity;
20
21 /***
22 * A validation object which is always valid.
23 *
24 * @author <a href="mailto:dev@avalon.apache.org">Avalon Development Team</a>
25 * @version CVS $Revision: 1.4 $ $Date: 2004/02/28 11:47:17 $
26 */
27 public final class NOPValidity
28 implements SourceValidity
29 {
30 public static final SourceValidity SHARED_INSTANCE = new NOPValidity();
31
32 /***
33 * Check if the component is still valid.
34 * If <code>0</code> is returned the isValid(SourceValidity) must be
35 * called afterwards!
36 * If -1 is returned, the component is not valid anymore and if +1
37 * is returnd, the component is valid.
38 */
39 public int isValid()
40 {
41 return 1;
42 }
43
44 public int isValid( final SourceValidity newValidity )
45 {
46 if (newValidity instanceof NOPValidity)
47 {
48 return 1;
49 }
50 return -1;
51 }
52
53 public String toString()
54 {
55 return "NOPValidity";
56 }
57 }