Home » Spring-Framework-090522 » org.springframework » beans » factory » [javadoc | source]

    1   /*
    2    * Copyright 2002-2007 the original author or authors.
    3    *
    4    * Licensed under the Apache License, Version 2.0 (the "License");
    5    * you may not use this file except in compliance with the License.
    6    * You may obtain a copy of the License at
    7    *
    8    *      http://www.apache.org/licenses/LICENSE-2.0
    9    *
   10    * Unless required by applicable law or agreed to in writing, software
   11    * distributed under the License is distributed on an "AS IS" BASIS,
   12    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   13    * See the License for the specific language governing permissions and
   14    * limitations under the License.
   15    */
   16   
   17   package org.springframework.beans.factory;
   18   
   19   import org.springframework.beans.BeansException;
   20   
   21   /**
   22    * Defines a factory which can return an Object instance
   23    * (possibly shared or independent) when invoked.
   24    *
   25    * <p>This interface is typically used to encapsulate a generic factory which
   26    * returns a new instance (prototype) of some target object on each invocation.
   27    *
   28    * <p>This interface is similar to {@link FactoryBean}, but implementations
   29    * of the latter are normally meant to be defined as SPI instances in a
   30    * {@link BeanFactory}, while implementations of this class are normally meant
   31    * to be fed as an API to other beans (through injection). As such, the
   32    * <code>getObject()</code> method has different exception handling behavior.
   33    *
   34    * @author Colin Sampaleanu
   35    * @since 1.0.2
   36    * @see FactoryBean
   37    */
   38   public interface ObjectFactory {
   39   
   40   	/**
   41   	 * Return an instance (possibly shared or independent)
   42   	 * of the object managed by this factory.
   43   	 * @return an instance of the bean (should never be <code>null</code>)
   44   	 * @throws BeansException in case of creation errors
   45   	 */
   46   	Object getObject() throws BeansException;
   47   
   48   }

Home » Spring-Framework-090522 » org.springframework » beans » factory » [javadoc | source]