Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » Detail formater
Detail formater [message #1698409] Mon, 15 June 2015 07:50
Eclipse UserFriend
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
Previous Topic:Java returned exitcode 13
Next Topic:eclipse cannot startup without any error message
Goto Forum:
  


Current Time: Thu Apr 24 02:52:49 EDT 2025

Powered by FUDForum. Page generated in 0.03334 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top