Java Doc for BeanFactoryUtils.java in  » J2EE » spring-framework-2.0.6 » org » springframework » beans » factory » 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 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.springframework.beans.factory.BeanFactoryUtils

BeanFactoryUtils
abstract public class BeanFactoryUtils (Code)
Convenience methods operating on bean factories, in particular on the ListableBeanFactory interface.

Returns bean counts, bean names or bean instances, taking into account the nesting hierarchy of a bean factory (which the methods defined on the ListableBeanFactory interface don't, in contrast to the methods defined on the BeanFactory interface).
author:
   Rod Johnson
author:
   Juergen Hoeller
since:
   04.07.2003



Field Summary
final public static  StringGENERATED_BEAN_NAME_SEPARATOR
     Separator for generated bean names.


Method Summary
public static  String[]beanNamesForTypeIncludingAncestors(ListableBeanFactory lbf, Class type)
     Get all bean names for the given type, including those defined in ancestor factories.
public static  String[]beanNamesForTypeIncludingAncestors(ListableBeanFactory lbf, Class type, boolean includePrototypes, boolean allowEagerInit)
     Get all bean names for the given type, including those defined in ancestor factories.
public static  String[]beanNamesIncludingAncestors(ListableBeanFactory lbf)
     Return all bean names in the factory, including ancestor factories.
public static  ObjectbeanOfType(ListableBeanFactory lbf, Class type)
     Return a single bean of the given type or subtypes, not looking in ancestor factories.
public static  ObjectbeanOfType(ListableBeanFactory lbf, Class type, boolean includePrototypes, boolean allowEagerInit)
     Return a single bean of the given type or subtypes, not looking in ancestor factories.
public static  ObjectbeanOfTypeIncludingAncestors(ListableBeanFactory lbf, Class type)
     Return a single bean of the given type or subtypes, also picking up beans defined in ancestor bean factories if the current bean factory is a HierarchicalBeanFactory.
public static  ObjectbeanOfTypeIncludingAncestors(ListableBeanFactory lbf, Class type, boolean includePrototypes, boolean allowEagerInit)
     Return a single bean of the given type or subtypes, also picking up beans defined in ancestor bean factories if the current bean factory is a HierarchicalBeanFactory.
public static  MapbeansOfTypeIncludingAncestors(ListableBeanFactory lbf, Class type)
     Return all beans of the given type or subtypes, also picking up beans defined in ancestor bean factories if the current bean factory is a HierarchicalBeanFactory. The returned Map will only contain beans of this type.

Does consider objects created by FactoryBeans, which means that FactoryBeans will get initialized.

public static  MapbeansOfTypeIncludingAncestors(ListableBeanFactory lbf, Class type, boolean includePrototypes, boolean allowEagerInit)
     Return all beans of the given type or subtypes, also picking up beans defined in ancestor bean factories if the current bean factory is a HierarchicalBeanFactory. The returned Map will only contain beans of this type.

Does consider objects created by FactoryBeans if the "allowEagerInit" flag is set, which means that FactoryBeans will get initialized.

public static  intcountBeansIncludingAncestors(ListableBeanFactory lbf)
     Count all beans in any hierarchy in which this factory participates.
public static  booleanisFactoryDereference(String name)
     Return whether the given name is a factory dereference (beginning with the factory dereference prefix).
public static  StringoriginalBeanName(String name)
     Extract the "raw" bean name from the given (potentially generated) bean name, excluding any "#..." suffixes which might have been added for uniqueness.
public static  StringtransformedBeanName(String name)
     Return the actual bean name, stripping out the factory dereference prefix (if any, also stripping repeated factory prefixes if found).

Field Detail
GENERATED_BEAN_NAME_SEPARATOR
final public static String GENERATED_BEAN_NAME_SEPARATOR(Code)
Separator for generated bean names. If a class name or parent name is not unique, "#1", "#2" etc will be appended, until the name becomes unique.





Method Detail
beanNamesForTypeIncludingAncestors
public static String[] beanNamesForTypeIncludingAncestors(ListableBeanFactory lbf, Class type)(Code)
Get all bean names for the given type, including those defined in ancestor factories. Will return unique names in case of overridden bean definitions.

Does consider objects created by FactoryBeans, which means that FactoryBeans will get initialized. If the object created by the FactoryBean doesn't match, the raw FactoryBean itself will be matched against the type.

This version of beanNamesForTypeIncludingAncestors automatically includes prototypes and FactoryBeans.
Parameters:
  lbf - the bean factory
Parameters:
  type - the type that beans must match the array of matching bean names, or an empty array if none




beanNamesForTypeIncludingAncestors
public static String[] beanNamesForTypeIncludingAncestors(ListableBeanFactory lbf, Class type, boolean includePrototypes, boolean allowEagerInit)(Code)
Get all bean names for the given type, including those defined in ancestor factories. Will return unique names in case of overridden bean definitions.

Does consider objects created by FactoryBeans if the "allowEagerInit" flag is set, which means that FactoryBeans will get initialized. If the object created by the FactoryBean doesn't match, the raw FactoryBean itself will be matched against the type. If "allowEagerInit" is not set, only raw FactoryBeans will be checked (which doesn't require initialization of each FactoryBean).
Parameters:
  lbf - the bean factory
Parameters:
  includePrototypes - whether to include prototype beans too or just singletons(also applies to FactoryBeans)
Parameters:
  allowEagerInit - whether to initialize lazy-init singletons andobjects created by FactoryBeans (or by factory methods with a"factory-bean" reference) for the type check. Note that FactoryBeans need to beeagerly initialized to determine their type: So be aware that passing in "true"for this flag will initialize FactoryBeans and "factory-bean" references.
Parameters:
  type - the type that beans must match the array of matching bean names, or an empty array if none




beanNamesIncludingAncestors
public static String[] beanNamesIncludingAncestors(ListableBeanFactory lbf)(Code)
Return all bean names in the factory, including ancestor factories.
Parameters:
  lbf - the bean factory the array of matching bean names, or an empty array if none
See Also:   BeanFactoryUtils.beanNamesForTypeIncludingAncestors



beanOfType
public static Object beanOfType(ListableBeanFactory lbf, Class type) throws BeansException(Code)
Return a single bean of the given type or subtypes, not looking in ancestor factories. Useful convenience method when we expect a single bean and don't care about the bean name.

Does consider objects created by FactoryBeans, which means that FactoryBeans will get initialized. If the object created by the FactoryBean doesn't match, the raw FactoryBean itself will be matched against the type.

This version of beanOfType automatically includes prototypes and FactoryBeans.
Parameters:
  lbf - the bean factory
Parameters:
  type - type of bean to match the matching bean instance
throws:
  org.springframework.beans.factory.NoSuchBeanDefinitionException - if 0 or more than 1 beans of the given type were found
throws:
  org.springframework.beans.factory.NoSuchBeanDefinitionException - if no single bean could be found for the given type
throws:
  BeansException - if the bean could not be created




beanOfType
public static Object beanOfType(ListableBeanFactory lbf, Class type, boolean includePrototypes, boolean allowEagerInit) throws BeansException(Code)
Return a single bean of the given type or subtypes, not looking in ancestor factories. Useful convenience method when we expect a single bean and don't care about the bean name.

Does consider objects created by FactoryBeans if the "allowEagerInit" flag is set, which means that FactoryBeans will get initialized. If the object created by the FactoryBean doesn't match, the raw FactoryBean itself will be matched against the type. If "allowEagerInit" is not set, only raw FactoryBeans will be checked (which doesn't require initialization of each FactoryBean).
Parameters:
  lbf - the bean factory
Parameters:
  type - type of bean to match
Parameters:
  includePrototypes - whether to include prototype beans too or just singletons(also applies to FactoryBeans)
Parameters:
  allowEagerInit - whether to initialize lazy-init singletons andobjects created by FactoryBeans (or by factory methods with a"factory-bean" reference) for the type check. Note that FactoryBeans need to beeagerly initialized to determine their type: So be aware that passing in "true"for this flag will initialize FactoryBeans and "factory-bean" references. the matching bean instance
throws:
  org.springframework.beans.factory.NoSuchBeanDefinitionException - if 0 or more than 1 beans of the given type were found
throws:
  org.springframework.beans.factory.NoSuchBeanDefinitionException - if no single bean could be found for the given type
throws:
  BeansException - if the bean could not be created




beanOfTypeIncludingAncestors
public static Object beanOfTypeIncludingAncestors(ListableBeanFactory lbf, Class type) throws BeansException(Code)
Return a single bean of the given type or subtypes, also picking up beans defined in ancestor bean factories if the current bean factory is a HierarchicalBeanFactory. Useful convenience method when we expect a single bean and don't care about the bean name.

Does consider objects created by FactoryBeans, which means that FactoryBeans will get initialized. If the object created by the FactoryBean doesn't match, the raw FactoryBean itself will be matched against the type.

This version of beanOfTypeIncludingAncestors automatically includes prototypes and FactoryBeans.
Parameters:
  lbf - the bean factory
Parameters:
  type - type of bean to match the matching bean instance
throws:
  org.springframework.beans.factory.NoSuchBeanDefinitionException - if 0 or more than 1 beans of the given type were found
throws:
  org.springframework.beans.factory.NoSuchBeanDefinitionException - if no single bean could be found for the given type
throws:
  BeansException - if the bean could not be created




beanOfTypeIncludingAncestors
public static Object beanOfTypeIncludingAncestors(ListableBeanFactory lbf, Class type, boolean includePrototypes, boolean allowEagerInit) throws BeansException(Code)
Return a single bean of the given type or subtypes, also picking up beans defined in ancestor bean factories if the current bean factory is a HierarchicalBeanFactory. Useful convenience method when we expect a single bean and don't care about the bean name.

Does consider objects created by FactoryBeans if the "allowEagerInit" flag is set, which means that FactoryBeans will get initialized. If the object created by the FactoryBean doesn't match, the raw FactoryBean itself will be matched against the type. If "allowEagerInit" is not set, only raw FactoryBeans will be checked (which doesn't require initialization of each FactoryBean).
Parameters:
  lbf - the bean factory
Parameters:
  type - type of bean to match
Parameters:
  includePrototypes - whether to include prototype beans too or just singletons(also applies to FactoryBeans)
Parameters:
  allowEagerInit - whether to initialize lazy-init singletons andobjects created by FactoryBeans (or by factory methods with a"factory-bean" reference) for the type check. Note that FactoryBeans need to beeagerly initialized to determine their type: So be aware that passing in "true"for this flag will initialize FactoryBeans and "factory-bean" references. the matching bean instance
throws:
  org.springframework.beans.factory.NoSuchBeanDefinitionException - if 0 or more than 1 beans of the given type were found
throws:
  org.springframework.beans.factory.NoSuchBeanDefinitionException - if no single bean could be found for the given type
throws:
  BeansException - if the bean could not be created




beansOfTypeIncludingAncestors
public static Map beansOfTypeIncludingAncestors(ListableBeanFactory lbf, Class type) throws BeansException(Code)
Return all beans of the given type or subtypes, also picking up beans defined in ancestor bean factories if the current bean factory is a HierarchicalBeanFactory. The returned Map will only contain beans of this type.

Does consider objects created by FactoryBeans, which means that FactoryBeans will get initialized. If the object created by the FactoryBean doesn't match, the raw FactoryBean itself will be matched against the type.
Parameters:
  lbf - the bean factory
Parameters:
  type - type of bean to match the Map of matching bean instances, or an empty Map if none
throws:
  BeansException - if a bean could not be created




beansOfTypeIncludingAncestors
public static Map beansOfTypeIncludingAncestors(ListableBeanFactory lbf, Class type, boolean includePrototypes, boolean allowEagerInit) throws BeansException(Code)
Return all beans of the given type or subtypes, also picking up beans defined in ancestor bean factories if the current bean factory is a HierarchicalBeanFactory. The returned Map will only contain beans of this type.

Does consider objects created by FactoryBeans if the "allowEagerInit" flag is set, which means that FactoryBeans will get initialized. If the object created by the FactoryBean doesn't match, the raw FactoryBean itself will be matched against the type. If "allowEagerInit" is not set, only raw FactoryBeans will be checked (which doesn't require initialization of each FactoryBean).
Parameters:
  lbf - the bean factory
Parameters:
  type - type of bean to match
Parameters:
  includePrototypes - whether to include prototype beans too or just singletons(also applies to FactoryBeans)
Parameters:
  allowEagerInit - whether to initialize lazy-init singletons andobjects created by FactoryBeans (or by factory methods with a"factory-bean" reference) for the type check. Note that FactoryBeans need to beeagerly initialized to determine their type: So be aware that passing in "true"for this flag will initialize FactoryBeans and "factory-bean" references. the Map of matching bean instances, or an empty Map if none
throws:
  BeansException - if a bean could not be created




countBeansIncludingAncestors
public static int countBeansIncludingAncestors(ListableBeanFactory lbf)(Code)
Count all beans in any hierarchy in which this factory participates. Includes counts of ancestor bean factories.

Beans that are "overridden" (specified in a descendant factory with the same name) are only counted once.
Parameters:
  lbf - the bean factory count of beans including those defined in ancestor factories




isFactoryDereference
public static boolean isFactoryDereference(String name)(Code)
Return whether the given name is a factory dereference (beginning with the factory dereference prefix).
Parameters:
  name - the name of the bean whether the given name is a factory dereference
See Also:   BeanFactory.FACTORY_BEAN_PREFIX



originalBeanName
public static String originalBeanName(String name)(Code)
Extract the "raw" bean name from the given (potentially generated) bean name, excluding any "#..." suffixes which might have been added for uniqueness.
Parameters:
  name - the potentially generated bean name the raw bean name
See Also:   BeanFactoryUtils.GENERATED_BEAN_NAME_SEPARATOR



transformedBeanName
public static String transformedBeanName(String name)(Code)
Return the actual bean name, stripping out the factory dereference prefix (if any, also stripping repeated factory prefixes if found).
Parameters:
  name - the name of the bean the transformed name
See Also:   BeanFactory.FACTORY_BEAN_PREFIX



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.