Java Doc for BeanHelper.java in  » Library » Apache-commons-configuration-1.4-src » org » apache » commons » configuration » beanutils » 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 » Library » Apache commons configuration 1.4 src » org.apache.commons.configuration.beanutils 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.apache.commons.configuration.beanutils.BeanHelper

BeanHelper
public class BeanHelper (Code)

A helper class for creating bean instances that are defined in configuration files.

This class provides static utility methods related to bean creation operations. These methods simplify such operations because a client need not deal with all involved interfaces. Usually, if a bean declaration has already been obtained, a single method call is necessary to create a new bean instance.

This class also supports the registration of custom bean factories. Implementations of the BeanFactory interface can be registered under a symbolic name using the registerBeanFactory() method. In the configuration file the name of the bean factory can be specified in the bean declaration. Then this factory will be used to create the bean.


since:
   1.3
author:
   Oliver Heger
version:
   $Id: BeanHelper.java 508152 2007-02-15 21:16:37Z oheger $




Method Summary
public static  ObjectcreateBean(BeanDeclaration data, Class defaultClass, Object param)
     The main method for creating and initializing beans from a configuration. This method will return an initialized instance of the bean class specified in the passed in bean declaration.
public static  ObjectcreateBean(BeanDeclaration data, Class defaultClass)
     Returns a bean instance for the specified declaration.
public static  ObjectcreateBean(BeanDeclaration data)
     Returns a bean instance for the specified declaration.
public static  BeanFactoryderegisterBeanFactory(String name)
     Deregisters the bean factory with the given name.
public static  BeanFactorygetDefaultBeanFactory()
     Returns the default bean factory.
public static  voidinitBean(Object bean, BeanDeclaration data)
     Initializes the passed in bean.
static  ClassloadClass(String name, Class callingClass)
     Returns a java.lang.Class object for the specified name. This method and the helper method it invokes are very similar to code extracted from the ClassLoaderUtils class of Commons Jelly.
public static  voidregisterBeanFactory(String name, BeanFactory factory)
     Register a bean factory under a symbolic name.
public static  SetregisteredFactoryNames()
     Returns a set with the names of all currently registered bean factories.
public static  voidsetDefaultBeanFactory(BeanFactory factory)
     Sets the default bean factory.



Method Detail
createBean
public static Object createBean(BeanDeclaration data, Class defaultClass, Object param) throws ConfigurationRuntimeException(Code)
The main method for creating and initializing beans from a configuration. This method will return an initialized instance of the bean class specified in the passed in bean declaration. If this declaration does not contain the class of the bean, the passed in default class will be used. From the bean declaration the factory to be used for creating the bean is queried. The declaration may here return null, then a default factory is used. This factory is then invoked to perform the create operation.
Parameters:
  data - the bean declaration
Parameters:
  defaultClass - the default class to use
Parameters:
  param - an additional parameter that will be passed to the beanfactory; some factories may support parameters and behave differentdepending on the value passed in here the new bean
throws:
  ConfigurationRuntimeException - if an error occurs



createBean
public static Object createBean(BeanDeclaration data, Class defaultClass) throws ConfigurationRuntimeException(Code)
Returns a bean instance for the specified declaration. This method is a short cut for createBean(data, null, null);.
Parameters:
  data - the bean declaration
Parameters:
  defaultClass - the class to be used when in the declation no classis specified the new bean
throws:
  ConfigurationRuntimeException - if an error occurs



createBean
public static Object createBean(BeanDeclaration data) throws ConfigurationRuntimeException(Code)
Returns a bean instance for the specified declaration. This method is a short cut for createBean(data, null);.
Parameters:
  data - the bean declaration the new bean
throws:
  ConfigurationRuntimeException - if an error occurs



deregisterBeanFactory
public static BeanFactory deregisterBeanFactory(String name)(Code)
Deregisters the bean factory with the given name. After that this factory cannot be used any longer.
Parameters:
  name - the name of the factory to be deregistered the factory that was registered under this name; null ifthere was no such factory



getDefaultBeanFactory
public static BeanFactory getDefaultBeanFactory()(Code)
Returns the default bean factory. the default bean factory



initBean
public static void initBean(Object bean, BeanDeclaration data) throws ConfigurationRuntimeException(Code)
Initializes the passed in bean. This method will obtain all the bean's properties that are defined in the passed in bean declaration. These properties will be set on the bean. If necessary, further beans will be created recursively.
Parameters:
  bean - the bean to be initialized
Parameters:
  data - the bean declaration
throws:
  ConfigurationRuntimeException - if a property cannot be set



loadClass
static Class loadClass(String name, Class callingClass) throws ClassNotFoundException(Code)
Returns a java.lang.Class object for the specified name. This method and the helper method it invokes are very similar to code extracted from the ClassLoaderUtils class of Commons Jelly. It should be replaced if Commons Lang provides a generic version.
Parameters:
  name - the name of the class to be loaded
Parameters:
  callingClass - the calling class the class object for the specified name
throws:
  ClassNotFoundException - if the class cannot be loaded



registerBeanFactory
public static void registerBeanFactory(String name, BeanFactory factory)(Code)
Register a bean factory under a symbolic name. This factory object can then be specified in bean declarations with the effect that this factory will be used to obtain an instance for the corresponding bean declaration.
Parameters:
  name - the name of the factory
Parameters:
  factory - the factory to be registered



registeredFactoryNames
public static Set registeredFactoryNames()(Code)
Returns a set with the names of all currently registered bean factories. a set with the names of the registered bean factories



setDefaultBeanFactory
public static void setDefaultBeanFactory(BeanFactory factory)(Code)
Sets the default bean factory. This factory will be used for all create operations, for which no special factory is provided in the bean declaration.
Parameters:
  factory - the default bean factory (must not be null)



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.