01: /*
02: * Copyright 2004-2007 the original author or authors.
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 org.springframework.webflow.execution;
17:
18: import java.io.ObjectStreamException;
19: import java.io.Serializable;
20:
21: /**
22: * Abstract base class for value objects that provide callers into a flow
23: * execution information about a logical response to issue and the data
24: * necessary to issue it.
25: * <p>
26: * This class is a generic marker returned when a request into an executing flow
27: * has completed processing, indicating a client response needs to be issued. An
28: * instance of a ViewSelection subclass represents the selection of a concrete
29: * response type. It is expected that callers introspect the returned view
30: * selection instance to handle the response types they support.
31: *
32: * @see FlowExecution
33: *
34: * @author Keith Donald
35: * @author Erwin Vervaet
36: */
37: public abstract class ViewSelection implements Serializable {
38:
39: /**
40: * Constant for a <code>null</code> or empty view selection, indicating no
41: * response should be issued.
42: */
43: public static final ViewSelection NULL_VIEW = new NullView();
44:
45: /**
46: * The definition of the 'null' view selection type, indicating that no
47: * response should be issued.
48: */
49: private static final class NullView extends ViewSelection {
50:
51: // resolve the singleton instance
52: private Object readResolve() throws ObjectStreamException {
53: return NULL_VIEW;
54: }
55:
56: public String toString() {
57: return "null";
58: }
59: }
60: }
|