KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > springframework > beans > factory > config > BeanDefinition


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.config;
18
19 import org.springframework.beans.BeanMetadataElement;
20 import org.springframework.beans.MutablePropertyValues;
21 import org.springframework.core.AttributeAccessor;
22
23 /**
24  * A BeanDefinition describes a bean instance, which has property values,
25  * constructor argument values, and further information supplied by
26  * concrete implementations.
27  *
28  * <p>This is just a minimal interface: The main intention is to allow a
29  * {@link BeanFactoryPostProcessor} such as {@link PropertyPlaceholderConfigurer}
30  * to introspect and modify property values and other bean metadata.
31  *
32  * @author Juergen Hoeller
33  * @author Rob Harrop
34  * @since 19.03.2004
35  * @see ConfigurableListableBeanFactory#getBeanDefinition
36  * @see org.springframework.beans.factory.support.RootBeanDefinition
37  * @see org.springframework.beans.factory.support.ChildBeanDefinition
38  */

39 public interface BeanDefinition extends AttributeAccessor, BeanMetadataElement {
40
41     /**
42      * Scope identifier for the standard singleton scope: "singleton".
43      * <p>Note that extended bean factories might support further scopes.
44      * @see #setScope
45      */

46     String JavaDoc SCOPE_SINGLETON = ConfigurableBeanFactory.SCOPE_SINGLETON;
47
48     /**
49      * Scope identifier for the standard prototype scope: "prototype".
50      * <p>Note that extended bean factories might support further scopes.
51      * @see #setScope
52      */

53     String JavaDoc SCOPE_PROTOTYPE = ConfigurableBeanFactory.SCOPE_PROTOTYPE;
54
55
56     /**
57      * Role hint indicating that a <code>BeanDefinition</code> is a major part
58      * of the application. Typically corresponds to a user-defined bean.
59      */

60     int ROLE_APPLICATION = 0;
61
62     /**
63      * Role hint indicating that a <code>BeanDefinition</code> is a supporting
64      * part of some larger configuration, typically an outer
65      * {@link org.springframework.beans.factory.parsing.ComponentDefinition}.
66      * <code>SUPPORT</code> beans are considered important enough to be aware
67      * of when looking more closely at a particular
68      * {@link org.springframework.beans.factory.parsing.ComponentDefinition}, but
69      * not when looking at the overall configuration of an application.
70      */

71     int ROLE_SUPPORT = 1;
72
73     /**
74      * Role hint indicating that a <code>BeanDefinition</code> is providing
75      * an entirely background role and has no relevance to the end-user. This
76      * hint is used when registering beans that are completely part of the internal
77      * workings of a {@link org.springframework.beans.factory.parsing.ComponentDefinition}.
78      */

79     int ROLE_INFRASTRUCTURE = 2;
80
81
82     /**
83      * Return the current bean class name of this bean definition.
84      * <p>Note that this does not have to be the actual class name used at runtime,
85      * in case of a child definition overriding/inheriting the class name from its parent.
86      * Hence, do <i>not</i> consider this to be the definitive bean type at runtime but
87      * rather only use it for parsing purposes at the individual bean definition level.
88      */

89     String JavaDoc getBeanClassName();
90
91     /**
92      * Override the bean class name of this bean definition.
93      * <p>The class name can be modified during bean factory post-processing,
94      * typically replacing the original class name with a parsed variant of it.
95      */

96     void setBeanClassName(String JavaDoc beanClassName);
97
98     /**
99      * Return the constructor argument values for this bean.
100      * <p>The returned instance can be modified during bean factory post-processing.
101      * @return the ConstructorArgumentValues object (never <code>null</code>)
102      */

103     ConstructorArgumentValues getConstructorArgumentValues();
104
105     /**
106      * Return the property values to be applied to a new instance of the bean.
107      * <p>The returned instance can be modified during bean factory post-processing.
108      * @return the MutablePropertyValues object (never <code>null</code>)
109      */

110     MutablePropertyValues getPropertyValues();
111
112
113     /**
114      * Return the name of the current target scope for this bean.
115      */

116     String JavaDoc getScope();
117
118     /**
119      * Override the target scope of this bean, specifying a new scope name.
120      * @see #SCOPE_SINGLETON
121      * @see #SCOPE_PROTOTYPE
122      */

123     void setScope(String JavaDoc scope);
124
125     /**
126      * Return whether this a <b>Singleton</b>, with a single, shared instance
127      * returned on all calls.
128      */

129     boolean isSingleton();
130
131     /**
132      * Return whether this bean is "abstract", that is, not meant to be instantiated.
133      */

134     boolean isAbstract();
135
136     /**
137      * Return whether this bean should be lazily initialized, that is, not
138      * eagerly instantiated on startup.
139      */

140     boolean isLazyInit();
141
142
143     /**
144      * Return a description of the resource that this bean definition
145      * came from (for the purpose of showing context in case of errors).
146      */

147     String JavaDoc getResourceDescription();
148
149     /**
150      * Get the role hint for this <code>BeanDefinition</code>. The role hint
151      * provides tools with an indication of the importance of a particular
152      * <code>BeanDefinition</code>.
153      * @see #ROLE_APPLICATION
154      * @see #ROLE_INFRASTRUCTURE
155      * @see #ROLE_SUPPORT
156      */

157     int getRole();
158
159 }
160
Popular Tags