Source Code Cross Referenced for ChildBeanDefinition.java in  » J2EE » spring-framework-2.0.6 » org » springframework » beans » factory » support » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » J2EE » spring framework 2.0.6 » org.springframework.beans.factory.support 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2002-2007 the original author or authors.
003:         *
004:         * Licensed under the Apache License, Version 2.0 (the "License");
005:         * you may not use this file except in compliance with the License.
006:         * You may obtain a copy of the License at
007:         *
008:         *      http://www.apache.org/licenses/LICENSE-2.0
009:         *
010:         * Unless required by applicable law or agreed to in writing, software
011:         * distributed under the License is distributed on an "AS IS" BASIS,
012:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013:         * See the License for the specific language governing permissions and
014:         * limitations under the License.
015:         */
016:
017:        package org.springframework.beans.factory.support;
018:
019:        import org.springframework.beans.MutablePropertyValues;
020:        import org.springframework.beans.factory.config.ConstructorArgumentValues;
021:        import org.springframework.util.ObjectUtils;
022:
023:        /**
024:         * Bean definition for beans which inherit settings from their parent.
025:         *
026:         * <p>Will use the bean class of the parent if none specified, but can
027:         * also override it. In the latter case, the child bean class must be
028:         * compatible with the parent, i.e. accept the parent's property values
029:         * and constructor argument values, if any.
030:         *
031:         * <p>A child bean definition will inherit constructor argument values,
032:         * property values and method overrides from the parent, with the option
033:         * to add new values. If init method, destroy method and/or static factory
034:         * method are specified, they will override the corresponding parent settings.
035:         *
036:         * <p>The remaining settings will <i>always</i> be taken from the child definition:
037:         * depends on, autowire mode, dependency check, singleton, lazy init.
038:         *
039:         * @author Rod Johnson
040:         * @author Juergen Hoeller
041:         * @see RootBeanDefinition
042:         */
043:        public class ChildBeanDefinition extends AbstractBeanDefinition {
044:
045:            private final String parentName;
046:
047:            /**
048:             * Create a new ChildBeanDefinition for the given parent, to be
049:             * configured through its bean properties and configuration methods.
050:             * @param parentName the name of the parent bean
051:             * @see #setBeanClass
052:             * @see #setBeanClassName
053:             * @see #setSingleton
054:             * @see #setAutowireMode
055:             * @see #setDependencyCheck
056:             * @see #setConstructorArgumentValues
057:             * @see #setPropertyValues
058:             */
059:            public ChildBeanDefinition(String parentName) {
060:                super ();
061:                this .parentName = parentName;
062:            }
063:
064:            /**
065:             * Create a new ChildBeanDefinition for the given parent.
066:             * @param parentName the name of the parent bean
067:             * @param pvs the additional property values of the child
068:             */
069:            public ChildBeanDefinition(String parentName,
070:                    MutablePropertyValues pvs) {
071:                super (null, pvs);
072:                this .parentName = parentName;
073:            }
074:
075:            /**
076:             * Create a new ChildBeanDefinition for the given parent.
077:             * @param parentName the name of the parent bean
078:             * @param cargs the constructor argument values to apply
079:             * @param pvs the additional property values of the child
080:             */
081:            public ChildBeanDefinition(String parentName,
082:                    ConstructorArgumentValues cargs, MutablePropertyValues pvs) {
083:
084:                super (cargs, pvs);
085:                this .parentName = parentName;
086:            }
087:
088:            /**
089:             * Create a new ChildBeanDefinition for the given parent,
090:             * providing constructor arguments and property values.
091:             * @param parentName the name of the parent bean
092:             * @param beanClass the class of the bean to instantiate
093:             * @param cargs the constructor argument values to apply
094:             * @param pvs the property values to apply
095:             */
096:            public ChildBeanDefinition(String parentName, Class beanClass,
097:                    ConstructorArgumentValues cargs, MutablePropertyValues pvs) {
098:
099:                super (cargs, pvs);
100:                this .parentName = parentName;
101:                setBeanClass(beanClass);
102:            }
103:
104:            /**
105:             * Create a new ChildBeanDefinition for the given parent,
106:             * providing constructor arguments and property values.
107:             * Takes a bean class name to avoid eager loading of the bean class.
108:             * @param parentName the name of the parent bean
109:             * @param beanClassName the name of the class to instantiate
110:             * @param cargs the constructor argument values to apply
111:             * @param pvs the property values to apply
112:             */
113:            public ChildBeanDefinition(String parentName, String beanClassName,
114:                    ConstructorArgumentValues cargs, MutablePropertyValues pvs) {
115:
116:                super (cargs, pvs);
117:                this .parentName = parentName;
118:                setBeanClassName(beanClassName);
119:            }
120:
121:            /**
122:             * Create a new ChildBeanDefinition as deep copy of the given
123:             * bean definition.
124:             * @param original the original bean definition to copy from
125:             */
126:            public ChildBeanDefinition(ChildBeanDefinition original) {
127:                super (original);
128:                this .parentName = original.getParentName();
129:            }
130:
131:            /**
132:             * Return the name of the parent definition of this bean definition.
133:             */
134:            public String getParentName() {
135:                return this .parentName;
136:            }
137:
138:            public void validate() throws BeanDefinitionValidationException {
139:                super .validate();
140:                if (this .parentName == null) {
141:                    throw new BeanDefinitionValidationException(
142:                            "'parentName' must be set in ChildBeanDefinition");
143:                }
144:            }
145:
146:            public boolean equals(Object other) {
147:                if (this  == other) {
148:                    return true;
149:                }
150:                if (!(other instanceof  ChildBeanDefinition)) {
151:                    return false;
152:                }
153:                ChildBeanDefinition that = (ChildBeanDefinition) other;
154:                return (ObjectUtils.nullSafeEquals(this .parentName,
155:                        that.parentName) && super .equals(other));
156:            }
157:
158:            public int hashCode() {
159:                return ObjectUtils.nullSafeHashCode(this .parentName) * 29
160:                        + super .hashCode();
161:            }
162:
163:            public String toString() {
164:                StringBuffer sb = new StringBuffer("Child bean with parent '");
165:                sb.append(this .parentName).append("': ").append(
166:                        super.toString());
167:                return sb.toString();
168:            }
169:
170:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.