KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > springframework > webflow > engine > WildcardTransitionCriteria


1 /*
2  * Copyright 2002-2006 the original author or authors.
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.springframework.webflow.engine;
17
18 import java.io.ObjectStreamException JavaDoc;
19 import java.io.Serializable JavaDoc;
20
21 import org.springframework.webflow.execution.RequestContext;
22
23 /**
24  * Transition criteria that always returns true.
25  *
26  * @author Keith Donald
27  */

28 public class WildcardTransitionCriteria implements TransitionCriteria, Serializable JavaDoc {
29     
30     /*
31      * Implementation note: not located in webflow.execution.support package to
32      * avoid a cyclic dependency between webflow.execution and webflow.execution.support.
33      */

34
35     /**
36      * Event id value ("*") that will cause the transition to match on any
37      * event.
38      */

39     public static final String JavaDoc WILDCARD_EVENT_ID = "*";
40
41     /**
42      * Shared instance of a TransitionCriteria that always returns true.
43      */

44     public static final WildcardTransitionCriteria INSTANCE = new WildcardTransitionCriteria();
45
46     /**
47      * Private constructor because this is a singleton.
48      */

49     private WildcardTransitionCriteria() {
50     }
51
52     public boolean test(RequestContext context) {
53         return true;
54     }
55
56     // resolve the singleton instance
57
private Object JavaDoc readResolve() throws ObjectStreamException JavaDoc {
58         return INSTANCE;
59     }
60
61     public String JavaDoc toString() {
62         return WILDCARD_EVENT_ID;
63     }
64 }
Popular Tags