Bug fixes, Configurable is only looking for public fields

This commit is contained in:
Ziver Koc 2016-01-15 17:06:44 +01:00
parent fdc8c8caf5
commit f8b9a86d65
3 changed files with 8 additions and 8 deletions

BIN
Zutil.jar

Binary file not shown.

4
src/zutil/io/StringOutputStream.java Normal file → Executable file
View file

@ -62,9 +62,7 @@ public class StringOutputStream extends OutputStream{
* Same as {@link OutputStream:clear()}
*/
@Override
public void close() {
clear();
}
public void close() {}
/**
* Clears the String buffer

View file

@ -110,24 +110,26 @@ public class Configurator<T> {
/**
* Uses a Map to assign all parameters of the Object
*/
public void setValues(Map<String,String> parameters){
public Configurator<T> setValues(Map<String,String> parameters){
for(ConfigurationParam param : this.params){
if(parameters.containsKey(param.getName()))
param.setValue(parameters.get(param.getName()));
}
return this;
}
/**
* Uses a Map to assign all parameters of the Object.
* NOTE: the DataNode must be of type Map
*/
public void setValues(DataNode node){
public Configurator<T> setValues(DataNode node){
if(!node.isMap())
return;
return this;
for(ConfigurationParam param : this.params){
if(node.get(param.getName()) != null)
param.setValue(node.getString(param.getName()));
}
return this;
}
public DataNode getValuesAsNode(){
@ -156,7 +158,7 @@ public class Configurator<T> {
if(param.isTypeString())
strParams.append(": '").append(param.getString()).append("', ");
else
strParams.append(param.getString());
strParams.append(": ").append(param.getString());
}
} catch (IllegalAccessException e) {
logger.log(Level.WARNING, null, e);
@ -165,7 +167,7 @@ public class Configurator<T> {
((ConfigurationActionListener) obj).postConfigurationAction();
}
if(logger.isLoggable(Level.FINE))
logger.fine("Configured object: " + obj.getClass().getSimpleName() + "("+ strParams +")");
logger.fine("Configured object: " + obj.getClass().getName() + " ("+ strParams +")");
}