1 /* 2 * Copyright 2004 The Apache Software Foundation. 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 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 11:49:19 -0400 (Tue, 26 Jul 2005) $ 23 */ 24 class _AttachedStateWrapper 25 implements Serializable 26 { 27 private static final long serialVersionUID = 4948301780259917764L; 28 private Class _class; 29 private Object _wrappedStateObject; 30 31 /** 32 * @param clazz null means wrappedStateObject is a List of state objects 33 * @param wrappedStateObject 34 */ 35 public _AttachedStateWrapper(Class clazz, Object wrappedStateObject) 36 { 37 if (wrappedStateObject != null && !(wrappedStateObject instanceof Serializable)) 38 { 39 throw new IllegalArgumentException("Attached state for Object of type " + clazz + " (Class " + wrappedStateObject.getClass().getName() + ") is not serializable"); 40 } 41 _class = clazz; 42 _wrappedStateObject = wrappedStateObject; 43 } 44 45 public Class getClazz() 46 { 47 return _class; 48 } 49 50 public Object getWrappedStateObject() 51 { 52 return _wrappedStateObject; 53 } 54 }