01: /*
02: * Copyright 2004 The Apache Software Foundation.
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 javax.faces.component;
17:
18: import java.io.Serializable;
19:
20: /**
21: * @author Manfred Geiler (latest modification by $Author: bdudney $)
22: * @version $Revision: 225333 $ $Date: 2005-07-26 17:49:19 +0200 (Di, 26 Jul 2005) $
23: */
24: class _AttachedStateWrapper implements Serializable {
25: private static final long serialVersionUID = 4948301780259917764L;
26: private Class _class;
27: private Object _wrappedStateObject;
28:
29: /**
30: * @param clazz null means wrappedStateObject is a List of state objects
31: * @param wrappedStateObject
32: */
33: public _AttachedStateWrapper(Class clazz, Object wrappedStateObject) {
34: if (wrappedStateObject != null
35: && !(wrappedStateObject instanceof Serializable)) {
36: throw new IllegalArgumentException(
37: "Attached state for Object of type " + clazz
38: + " (Class "
39: + wrappedStateObject.getClass().getName()
40: + ") is not serializable");
41: }
42: _class = clazz;
43: _wrappedStateObject = wrappedStateObject;
44: }
45:
46: public Class getClazz() {
47: return _class;
48: }
49:
50: public Object getWrappedStateObject() {
51: return _wrappedStateObject;
52: }
53: }
|