01: /*
02: * Copyright 2002-2006 the original author or authors.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
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 FactoryBean, but implementations of the latter
29: * are normally meant to be defined as instances by the user in a BeanFactory,
30: * while implementations of this class are normally meant to be fed as a property
31: * to other beans. As such, the <code>getObject</code> method has different
32: * exception handling behavior.
33: *
34: * @author Colin Sampaleanu
35: * @since 11.05.2004
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: }
|