001    /**
002     * Copyright (c) 2000-2012 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
014    
015    package com.liferay.portal.kernel.servlet;
016    
017    import java.io.Serializable;
018    
019    /**
020     * @author Igor Spasic
021     */
022    public final class NonSerializableObjectHandler implements Serializable {
023    
024            public static Object getValue(Object value) {
025                    if (value instanceof NonSerializableObjectHandler) {
026                            NonSerializableObjectHandler nonSerializableObjectHandler =
027                                    (NonSerializableObjectHandler)value;
028    
029                            value = nonSerializableObjectHandler.getValue();
030                    }
031    
032                    return value;
033            }
034    
035            public NonSerializableObjectHandler(Object value) {
036                    while (value instanceof NonSerializableObjectHandler) {
037                            NonSerializableObjectHandler nonSerializableObjectHandler =
038                                    (NonSerializableObjectHandler)value;
039    
040                            value = nonSerializableObjectHandler.getValue();
041                    }
042    
043                    _value = value;
044            }
045    
046            public Object getValue() {
047                    return _value;
048            }
049    
050            private transient Object _value;
051    
052    }