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.references; 010 011 import java.io.Serializable; 012 013 import org.picocontainer.ObjectReference; 014 015 /** 016 * Simple instance implementation of ObjectReference. 017 * 018 * @author Aslak Hellesøy 019 * @author Konstantin Pribluda 020 */ 021 @SuppressWarnings("serial") 022 public class SimpleReference<T> implements ObjectReference<T>, 023 Serializable { 024 private T instance; 025 026 public SimpleReference() { 027 // no-op 028 } 029 030 public T get() { 031 return instance; 032 } 033 034 public void set(T item) { 035 this.instance = item; 036 } 037 }