KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > springframework > beans > factory > SmartFactoryBean


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 /**
20  * Extension of the {@link FactoryBean} interface. Implementations may
21  * indicate whether they always return independent instances, for the
22  * case where their {@link #isSingleton()} implementation returning
23  * <code>false</code> does not clearly indicate independent instances.
24  *
25  * <p>Plain {@link FactoryBean} implementations which do not implement
26  * this extended interface are simply assumed to always return independent
27  * instances if their {@link #isSingleton()} implementation returns
28  * <code>false</code>.
29  *
30  * <p><b>NOTE:</b> This interface is a special purpose interface, mainly for
31  * internal use within the framework. In general, application-provided
32  * FactoryBeans should simply implement the plain {@link FactoryBean} interface.
33  *
34  * @author Juergen Hoeller
35  * @since 2.0.3
36  * @see #isPrototype()
37  * @see #isSingleton()
38  */

39 public interface SmartFactoryBean extends FactoryBean {
40
41     /**
42      * Is the object managed by this factory a prototype? That is,
43      * will {@link #getObject()} always return an independent instance?
44      * <p>The prototype status of the FactoryBean itself will generally
45      * be provided by the owning {@link BeanFactory}; usually, it has to be
46      * defined as singleton there.
47      * <p>This method is supposed to strictly check for independent instances;
48      * it should not return <code>true</code> for scoped objects or other
49      * kinds of non-singleton, non-independent objects. For this reason,
50      * this is not simply the inverted form of {@link #isSingleton()}.
51      * @return if the exposed object is a prototype
52      * @see #getObject()
53      * @see #isSingleton()
54      */

55     boolean isPrototype();
56
57 }
58
Popular Tags