Object o;
int maxLen = 0;
String name, spaces;
Object value;
StringBuilder sb = new StringBuilder();
PropertyDescriptor pd;
List subNames = null, subValues = null;
for (Iterator iter = getProperties(obj, propScope).iterator(); iter.hasNext();) {
pd = (PropertyDescriptor) iter.next();
subNames = getStretchedElementNames(obj, pd);
if (subNames.size() > 0) {
for (Iterator it = subNames.iterator(); it.hasNext();) {
maxLen = Math.max(maxLen, ((String) it.next()).length());
}
} else {
name = EditorUtil.java2cName(obj, pd.getPropertyName());
maxLen = Math.max(maxLen, name.length());
}
}
for (Iterator iter = getProperties(obj, propScope).iterator(); iter.hasNext();) {
pd = (PropertyDescriptor) iter.next();
subNames = getStretchedElementNames(obj, pd);
if (subNames.size() > 0) {
subValues = getStretchedElementValues(obj, pd);
if (subNames.size() != subValues.size()) {
throw new IllegalArgumentException("Unknown error: Expecting name x value lists of a same size! Got sizes " + subNames.size() + " and " + subValues.size());
}
for (int j = 0; j < subNames.size(); j++) {
name = (String) subNames.get(j);
value = (String) subValues.get(j);
sb.append(name);
for (int i = name.length(); i < maxLen; i++) {
sb.append(' ');
}
sb.append(" " + value + "\n");
}
} else {
name = EditorUtil.java2cName(obj, pd.getPropertyName());
value = EditorUtil.translateObjectToStringValue(pd.getPropertyName(), EditorUtil.getPropertyValue(obj, pd));
if (obj instanceof Configuration && name.equals("hostname")) {
sb.append("#");
sb.append(value);
sb.append(":\n");
} else {