Java Doc for XMLBeanDeclaration.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.XMLBeanDeclaration

XMLBeanDeclaration
public class XMLBeanDeclaration implements BeanDeclaration(Code)

An implementation of the BeanDeclaration interface that is suitable for XML configuration files.

This class defines the standard layout of a bean declaration in an XML configuration file. Such a declaration must look like the following example fragement:

 ...
 <personBean config-class="my.model.PersonBean"
 lastName="Doe" firstName="John">
 <address config-class="my.model.AddressBean"
 street="21st street 11" zip="1234"
 city="TestCity"/>
 </personBean>
 

The bean declaration can be contained in an arbitrary element. Here it is the <personBean> element. In the attributes of this element there can occur some reserved attributes, which have the following meaning:

config-class
Here the full qualified name of the bean's class can be specified. An instance of this class will be created. If this attribute is not specified, the bean class must be provided in another way, e.g. as the defaultClass passed to the BeanHelper class.
config-factory
This attribute can contain the name of the BeanFactory that should be used for creating the bean. If it is defined, a factory with this name must have been registered at the BeanHelper class. If this attribute is missing, the default bean factory will be used.
config-factoryParam
With this attribute a parameter can be specified that will be passed to the bean factory. This may be useful for custom bean factories.

All further attributes starting with the config- prefix are considered as meta data and will be ignored. All other attributes are treated as properties of the bean to be created, i.e. corresponding setter methods of the bean will be invoked with the values specified here.

If the bean to be created has also some complex properties (which are itself beans), their values cannot be initialized from attributes. For this purpose nested elements can be used. The example listing shows how an address bean can be initialized. This is done in a nested element whose name must match the name of a property of the enclosing bean declaration. The format of this nested element is exactly the same as for the bean declaration itself, i.e. it can have attributes defining meta data or bean properties and even further nested elements for complex bean properties.

A XMLBeanDeclaration object is usually created from a HierarchicalConfiguration. From this it will derive a SubnodeConfiguration, which is used to access the needed properties. This subnode configuration can be obtained using the XMLBeanDeclaration.getConfiguration() method. All of its properties can be accessed in the usual way. To ensure that the property keys used by this class are understood by the configuration, the default expression engine will be set.


since:
   1.3
author:
   Oliver Heger
version:
   $Id: XMLBeanDeclaration.java 439648 2006-09-02 20:42:10Z oheger $


Field Summary
final public static  StringATTR_BEAN_CLASS
     Constant for the bean class attribute.
final public static  StringATTR_BEAN_FACTORY
     Constant for the bean factory attribute.
final public static  StringATTR_FACTORY_PARAM
     Constant for the bean factory parameter attribute.
final public static  StringATTR_PREFIX
     Constant for the prefix for reserved attributes.
final public static  StringRESERVED_PREFIX
     Constant for the prefix of reserved attributes.

Constructor Summary
public  XMLBeanDeclaration(HierarchicalConfiguration config, String key)
     Creates a new instance of XMLBeanDeclaration and initializes it from the given configuration.
public  XMLBeanDeclaration(HierarchicalConfiguration config, String key, boolean optional)
     Creates a new instance of XMLBeanDeclaration and initializes it from the given configuration.
public  XMLBeanDeclaration(HierarchicalConfiguration config)
     Creates a new instance of XMLBeanDeclaration and initializes it from the given configuration.
public  XMLBeanDeclaration(SubnodeConfiguration config, ConfigurationNode node)
     Creates a new instance of XMLBeanDeclaration and initializes it with the configuration node that contains the bean declaration.

Method Summary
public  StringgetBeanClassName()
     Returns the name of the class of the bean to be created.
public  StringgetBeanFactoryName()
     Returns the name of the bean factory.
public  ObjectgetBeanFactoryParameter()
     Returns a parameter for the bean factory.
public  MapgetBeanProperties()
     Returns a map with the bean's (simple) properties.
public  SubnodeConfigurationgetConfiguration()
     Returns the configuration object this bean declaration is based on.
public  MapgetNestedBeanDeclarations()
     Returns a map with bean declarations for the complex properties of the bean to be created.
public  ConfigurationNodegetNode()
     Returns the node that contains the bean declaration.
protected  Objectinterpolate(Object value)
     Performs interpolation for the specified value.
protected  booleanisReservedNode(ConfigurationNode nd)
     Checks if the specified node is reserved and thus should be ignored.

Field Detail
ATTR_BEAN_CLASS
final public static String ATTR_BEAN_CLASS(Code)
Constant for the bean class attribute.



ATTR_BEAN_FACTORY
final public static String ATTR_BEAN_FACTORY(Code)
Constant for the bean factory attribute.



ATTR_FACTORY_PARAM
final public static String ATTR_FACTORY_PARAM(Code)
Constant for the bean factory parameter attribute.



ATTR_PREFIX
final public static String ATTR_PREFIX(Code)
Constant for the prefix for reserved attributes.



RESERVED_PREFIX
final public static String RESERVED_PREFIX(Code)
Constant for the prefix of reserved attributes.




Constructor Detail
XMLBeanDeclaration
public XMLBeanDeclaration(HierarchicalConfiguration config, String key)(Code)
Creates a new instance of XMLBeanDeclaration and initializes it from the given configuration. The passed in key points to the bean declaration.
Parameters:
  config - the configuration
Parameters:
  key - the key to the bean declaration (this key must point toexactly one bean declaration or a IllegalArgumentExceptionexception will be thrown)



XMLBeanDeclaration
public XMLBeanDeclaration(HierarchicalConfiguration config, String key, boolean optional)(Code)
Creates a new instance of XMLBeanDeclaration and initializes it from the given configuration. The passed in key points to the bean declaration. If the key does not exist and the boolean argument is true, the declaration is initialized with an empty configuration. It is possible to create objects from such an empty declaration if a default class is provided. If the key on the other hand has multiple values or is undefined and the boolean argument is false, a IllegalArgumentException exception will be thrown.
Parameters:
  config - the configuration
Parameters:
  key - the key to the bean declaration
Parameters:
  optional - a flag whether this declaration is optional; if set totrue, no exception will be thrown if the passed in key isundefined



XMLBeanDeclaration
public XMLBeanDeclaration(HierarchicalConfiguration config)(Code)
Creates a new instance of XMLBeanDeclaration and initializes it from the given configuration. The configuration's root node must contain the bean declaration.
Parameters:
  config - the configuration with the bean declaration



XMLBeanDeclaration
public XMLBeanDeclaration(SubnodeConfiguration config, ConfigurationNode node)(Code)
Creates a new instance of XMLBeanDeclaration and initializes it with the configuration node that contains the bean declaration.
Parameters:
  config - the configuration
Parameters:
  node - the node with the bean declaration.




Method Detail
getBeanClassName
public String getBeanClassName()(Code)
Returns the name of the class of the bean to be created. This information is obtained from the config-class attribute. the name of the bean's class



getBeanFactoryName
public String getBeanFactoryName()(Code)
Returns the name of the bean factory. This information is fetched from the config-factory attribute. the name of the bean factory



getBeanFactoryParameter
public Object getBeanFactoryParameter()(Code)
Returns a parameter for the bean factory. This information is fetched from the config-factoryParam attribute. the parameter for the bean factory



getBeanProperties
public Map getBeanProperties()(Code)
Returns a map with the bean's (simple) properties. The properties are collected from all attribute nodes, which are not reserved. a map with the bean's properties



getConfiguration
public SubnodeConfiguration getConfiguration()(Code)
Returns the configuration object this bean declaration is based on. the associated configuration



getNestedBeanDeclarations
public Map getNestedBeanDeclarations()(Code)
Returns a map with bean declarations for the complex properties of the bean to be created. These declarations are obtained from the child nodes of this declaration's root node. a map with bean declarations for complex properties



getNode
public ConfigurationNode getNode()(Code)
Returns the node that contains the bean declaration. the configuration node this bean declaration is based on



interpolate
protected Object interpolate(Object value)(Code)
Performs interpolation for the specified value. This implementation will interpolate against the current subnode configuration's parent. If sub classes need a different interpolation mechanism, they should override this method.
Parameters:
  value - the value that is to be interpolated the interpolated value



isReservedNode
protected boolean isReservedNode(ConfigurationNode nd)(Code)
Checks if the specified node is reserved and thus should be ignored. This method is called when the maps for the bean's properties and complex properties are collected. It checks whether the given node is an attribute node and if its name starts with the reserved prefix.
Parameters:
  nd - the node to be checked a flag whether this node is reserved (and does not point to aproperty)



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.