Hey,
I've created a detail formater (Preferences -> Java -> Debug -> Detail Formatters) for java.util.Collection.
if(this.isEmpty()) {
return "EMPTY !";
}
StringBuilder sb = new StringBuilder();
for (Object o : this) {
sb.append(String.format("%s \n", o.toString()));
}
return sb.toString();
This works fine for collections e.g. with strings but it's really nice with regular objects. Instead of just printing the toString output, I would like to check if the type (in my example 'o') has a detail formatter. The following (pseudo) code demonstrates my intention.
if(this.isEmpty()) {
return "EMPTY !";
}
StringBuilder sb = new StringBuilder();
for (Object o : this) {
if(o has DETAIL_FORMATER){
sb.append(GET_DTEAIL_FORMAT VALUE FOR o);
continue;
}
sb.append(String.format("%s \n", o.toString()));
}
return sb.toString();
Does this somehow work?
Thank you!
Kon