Am 21.04.2011 08:24, schrieb Jörg Schaible:
Hi Hen,

Henri Yandell wrote:

On Wed, Apr 20, 2011 at 3:25 PM, Gary Gregory<garydgreg...@gmail.com>
wrote:

[snip]


PairFormat class needed rather than relying on toString functionality :)

Could we implement Formattable?

+1

Something new learned today :)

- Jörg

Yes, indeed, this is a good option. I did not know this interface either.

Just blue sky thinking: AOP could also be used to solve this problem. A library like AspectJ would allow you to intercept calls to toString() methods of specific or all classes. In the aspect you could generate your specialized format.

The aspect could even be implemented in a generic way. It could be configured with a list of toString handlers for the classes whose format is to be adapted. All toString() invocations are intercepted. If a suitable handler for the current class is found, it is called. Otherwise the aspect proceeds with the regular toString() method.

Or is this too weird?

Oliver

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org

Reply via email to