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