M
MarkB
Hi
Im writing a new app and want to streamline the way i read and write
configurations to XML ini file.
In the past ive written lines and lines of code to write out
configuration which is ok, but a pain when you add new config
variables and forget to add them to the writeConfig methods.
I figured if i could iterate through a list of CLASS variables, then i
could write out the xml config based on the variable name and then add
the variable value.
E.g. (I know this is not valid java...just want to demonstrate my
thinking)
Class foobar(){
private String configVal1 = "Y";
private String configVal2 = "Hello";
public void writeConfig(String configFile){
Iterator it = new Iterator(of class variables)
do (it.hasNext())
if (it is type String){
Write "<" + it.variableName + ">" + it.variableName.Value +
"</" + it.variableName + ">";
}
}
}
}
Can this be done???? Ive tried search the web but there doesnt seem
to be much on it??
Cheers
Im writing a new app and want to streamline the way i read and write
configurations to XML ini file.
In the past ive written lines and lines of code to write out
configuration which is ok, but a pain when you add new config
variables and forget to add them to the writeConfig methods.
I figured if i could iterate through a list of CLASS variables, then i
could write out the xml config based on the variable name and then add
the variable value.
E.g. (I know this is not valid java...just want to demonstrate my
thinking)
Class foobar(){
private String configVal1 = "Y";
private String configVal2 = "Hello";
public void writeConfig(String configFile){
Iterator it = new Iterator(of class variables)
do (it.hasNext())
if (it is type String){
Write "<" + it.variableName + ">" + it.variableName.Value +
"</" + it.variableName + ">";
}
}
}
}
Can this be done???? Ive tried search the web but there doesnt seem
to be much on it??
Cheers