001    /**
002     * Copyright (c) 2000-2013 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     * @see    com.liferay.portal.kernel.util.TransientValue
022     */
023    public final class NonSerializableObjectHandler implements Serializable {
024    
025            public static Object getValue(Object value) {
026                    if (value instanceof NonSerializableObjectHandler) {
027                            NonSerializableObjectHandler nonSerializableObjectHandler =
028                                    (NonSerializableObjectHandler)value;
029    
030                            value = nonSerializableObjectHandler.getValue();
031                    }
032    
033                    return value;
034            }
035    
036            public NonSerializableObjectHandler(Object value) {
037                    while (value instanceof NonSerializableObjectHandler) {
038                            NonSerializableObjectHandler nonSerializableObjectHandler =
039                                    (NonSerializableObjectHandler)value;
040    
041                            value = nonSerializableObjectHandler.getValue();
042                    }
043    
044                    _value = value;
045            }
046    
047            public Object getValue() {
048                    return _value;
049            }
050    
051            private transient Object _value;
052    
053    }