001    /*
002     * (c) 2003-2005, 2009, 2010 ThoughtWorks Ltd
003     * All rights reserved.
004     *
005     * The software in this package is published under the terms of the BSD
006     * style license a copy of which has been included with this distribution in
007     * the LICENSE.txt file.
008     * 
009     * Created on 17-May-2004
010     */
011    package com.thoughtworks.proxy.kit;
012    
013    /**
014     * A way to refer to objects that are stored in "awkward" places (for example inside a <code>HttpSession</code> or
015     * {@link ThreadLocal}). This interface is typically implemented by someone integrating with an existing container.
016     *
017     * @author Joe Walnes
018     * @since 0.2
019     */
020    public interface ObjectReference<T> {
021        /**
022         * Retrieve an actual reference to the object. Returns null if the reference is not available or has not been
023         * populated yet.
024         *
025         * @return an actual reference to the object.
026         * @since 0.2
027         */
028        T get();
029    
030        /**
031         * Assign an object to the reference.
032         *
033         * @param item the object to assign to the reference. May be <code>null</code>.
034         * @since 0.2
035         */
036        void set(T item);
037    }