commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rgm <...@rgm.nu>
Subject [lang] Proposal: Allow extending DiffResult
Date Thu, 03 Mar 2016 16:31:04 GMT
Ironically, it seems impossible to override DiffResult.toString(), which
one may wish to do in order to provide alternate formats for the
differences that are more compact than "lhs differs from rhs."

In my case, I wanted to support differences between Set<Integer> so that
one could get output like:
Object[groups:  added: {1, 2}, removed: {7},name:cat->dog]

Rather than:
Object[groups:[3,4,7],name=cat] differs from Object[groups:
[1,2,3,4],name=dog]

To support this I ended up wrapping the DiffResult class because I could
not extend it due to its private constructor.

re:
https://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/builder/DiffResult.html

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message