1 package de.dlr.bt.stc.config; 2 3 import java.util.Objects; 4 5 import org.apache.commons.configuration2.HierarchicalConfiguration; 6 7 public abstract class ConfiguredObject { 8 protected final HierarchicalConfiguration<?> config; 9 10 protected ConfiguredObject(HierarchicalConfiguration<?> config) { 11 this.config = Objects.requireNonNull(config); 12 } 13 14 @Override 15 public String toString() { 16 StringBuilder sb = new StringBuilder(); 17 sb.append("{"); 18 var it = config.getKeys(); 19 while (it.hasNext()) { 20 var element = it.next(); 21 sb.append(element); 22 sb.append("=\""); 23 sb.append(config.getString(element)); 24 sb.append("\""); 25 if (it.hasNext()) 26 sb.append(","); 27 } 28 sb.append("}"); 29 return sb.toString(); 30 } 31 }