public class SimpleXMLConfigFile
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private org.w3c.dom.Document |
localXMLSource
The local XML source as
Document . |
private java.lang.String |
varElementName
The common tag name of an configuration element.
|
private java.lang.String |
varKeyAttributeName
The common attribute name of an configuration variable.
|
private java.lang.String |
xmlFilePath
The path which refers to the XML configuration file.
|
private java.lang.String |
xSettings
The common xPath to the settings.
|
Modifier | Constructor and Description |
---|---|
|
SimpleXMLConfigFile(java.lang.String path)
Creates a new
SimpleXMLConfigFile object and initially loads the Document from file. |
protected |
SimpleXMLConfigFile(java.lang.String path,
java.lang.String settingsX,
java.lang.String elementX,
java.lang.String attributeX)
Creates a new
SimpleXMLConfigFile object, with dissent standard access structure, and initially loads the
Document from file. |
Modifier and Type | Method and Description |
---|---|
private void |
checkLoad()
Loads the local XML source, if it's
null , by using refresh() . |
java.lang.String |
get(java.lang.String config)
Fetches the value of a certain configuration variable from the XML document.
|
java.lang.Boolean |
getBoolean(java.lang.String config)
Fetches the value of a certain configuration variable as
Boolean from the XML document. |
java.lang.Double |
getDouble(java.lang.String config)
Fetches the value of a certain configuration variable as
Double from the XML document. |
java.lang.Integer |
getInteger(java.lang.String config)
Fetches the value of a certain configuration variable as
Integer from the XML document. |
java.lang.Long |
getLong(java.lang.String config)
Fetches the value of a certain configuration variable as
Long from the XML document. |
void |
refresh()
Loads the local XML source from file using
XMLUtil.loadDocument(String) . |
private java.lang.String xSettings
private java.lang.String varElementName
private java.lang.String varKeyAttributeName
private java.lang.String xmlFilePath
private org.w3c.dom.Document localXMLSource
Document
.public SimpleXMLConfigFile(java.lang.String path)
SimpleXMLConfigFile
object and initially loads the Document
from file.path
- The path which refers to the XML configuration file.protected SimpleXMLConfigFile(java.lang.String path, java.lang.String settingsX, java.lang.String elementX, java.lang.String attributeX)
SimpleXMLConfigFile
object, with dissent standard access structure, and initially loads the
Document
from file.path
- The path which refers to the XML configuration file.settingsX
- The xPath to the settings.elementX
- The tag name of a configuration element.attributeX
- The name of the attibute which contains the name of the configuration variable.public final java.lang.String get(java.lang.String config)
config
- The name of the configuration variable as String
.String
.public final java.lang.Integer getInteger(java.lang.String config)
Integer
from the XML document.config
- The name of the configuration variable as String
.Integer
.public final java.lang.Double getDouble(java.lang.String config)
Double
from the XML document.config
- The name of the configuration variable as String
.Double
.public final java.lang.Long getLong(java.lang.String config)
Long
from the XML document.config
- The name of the configuration variable as String
.Long
.public final java.lang.Boolean getBoolean(java.lang.String config)
Boolean
from the XML document.config
- The name of the configuration variable as String
.Boolean
.private void checkLoad()
null
, by using refresh()
.public final void refresh()
XMLUtil.loadDocument(String)
.