public class XMLConfiguration extends Object
This class manages the configuration of a Java Bean by an xml configuration file. It also supports configuration of Log4J.
Constructor and Description |
---|
XMLConfiguration() |
Modifier and Type | Method and Description |
---|---|
Element |
getRootNode()
returns the configuration root element or null if init() has not been called.
|
void |
init(String filename,
boolean fromResource)
Initialize the configuration.
|
protected void |
readConfiguration(String fileName,
boolean fromResource)
Reads the configuration file and parses the XML Configuration.
|
void |
readProperties(Object bean,
Element propertiesNode)
reads all properties from a given properties node and applies them to the given bean
|
void |
readProperties(Object bean,
String... propertiesNodeNames)
reads all properties from a given properties node and applies them to the given bean
|
protected void |
setPropertyValue(Object bean,
Node item) |
public void init(String filename, boolean fromResource)
filename
- the filefromResource
- will read from the classpath if truepublic Element getRootNode()
protected void readConfiguration(String fileName, boolean fromResource)
public void readProperties(Object bean, String... propertiesNodeNames)
bean
- the bean to which to apply the configurationpropertiesNodeNames
- the name of the properties node below the root elementpublic void readProperties(Object bean, Element propertiesNode)
bean
- the bean to which to apply the configurationpropertiesNode
- the properties nodeCopyright © 2008–2022 Apache Software Foundation. All rights reserved.