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.engine;
17:
18: import java.io.ObjectStreamException;
19: import java.io.Serializable;
20:
21: import org.springframework.webflow.execution.RequestContext;
22: import org.springframework.webflow.execution.ViewSelection;
23:
24: /**
25: * Makes a null view selection, indicating no response should be issued.
26: *
27: * @see org.springframework.webflow.execution.ViewSelection#NULL_VIEW
28: *
29: * @author Keith Donald
30: */
31: public final class NullViewSelector implements ViewSelector,
32: Serializable {
33:
34: /*
35: * Implementation note: not located in webflow.execution.support package to
36: * avoid a cyclic dependency between webflow.execution and webflow.execution.support.
37: */
38:
39: /**
40: * The shared singleton {@link NullViewSelector} instance.
41: */
42: public static final ViewSelector INSTANCE = new NullViewSelector();
43:
44: /**
45: * Private constructor since this is a singleton.
46: */
47: private NullViewSelector() {
48: }
49:
50: public boolean isEntrySelectionRenderable(RequestContext context) {
51: return true;
52: }
53:
54: public ViewSelection makeEntrySelection(RequestContext context) {
55: return ViewSelection.NULL_VIEW;
56: }
57:
58: public ViewSelection makeRefreshSelection(RequestContext context) {
59: return makeEntrySelection(context);
60: }
61:
62: // resolve the singleton instance
63: private Object readResolve() throws ObjectStreamException {
64: return INSTANCE;
65: }
66:
67: }
|