/*
 * The contents of this file are subject to the Mozilla Public License Version 1.1
 * (the "License"); you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at <http://www.mozilla.org/MPL/>.
 * 
 * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT
 * WARRANTY OF ANY KIND, either express or implied. See the License for the specific
 * language governing rights and limitations under the License.
 * 
 * The Original Code is the Venice Web Communities System.
 * 
 * The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
 * for Silverwrist Design Studios.  Portions created by Eric J. Bowersox are
 * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios.  All Rights Reserved.
 * 
 * Contributor(s): 
 */
package com.silverwrist.util.cache;

/**
 * An interface which is used by <CODE>ObjectCache</CODE> to create new objects which match a specified
 * key.  An instance of an object implementing this interface must be specified to the constructor
 * of <CODE>ObjectFactory</CODE>.
 *
 * @see ObjectCache#Constructor(com.silverwrist.util.cache.ObjectFactory)
 * @see ObjectCache#getOrCreate(java.lang.Object)
 */
public interface ObjectFactory
{
  /**
   * Creates a new instance of an object for the object cache.
   *
   * @param key The key value of the new object to be created.
   * @return The new object instance.
   * @exception com.silverwrist.util.cache.ObjectFactoryException An exception was thrown by the
   *            constructors and/or methods called by <CODE>newObject</CODE>; it is wrapped in this exception.
   * @see ObjectCache#getOrCreate(java.lang.Object)
   */
  public abstract Object newObject(Object key) throws ObjectFactoryException;

} // end interface ObjectFactory
