[ 
https://issues.apache.org/jira/browse/LANG-637?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13462048#comment-13462048
 ] 

Duncan Jones commented on LANG-637:
-----------------------------------

After some consideration, I'm struggling to imagine _what_ exactly could be 
useful about a separate {{Diff}} object. In principle it seems like a fine idea 
and the first thing that came to mind would be methods to retrieve the 
differences via suitable getter methods. However, I can't think of a way to 
implement an interface that is not quite ugly.

Building the differences is elegant enough, via methods such as:

{code}
addBytes(String fieldName, byte lhs, byte rhs);
{code}

but storing and retrieving them seems challenging, other than as {{Object}} s.

Can anyone suggest how a {{Diff}} class could be structured and used? If not, 
then I may continue along the lines of my previous suggestions and focus on a 
{{DiffBuilder}} class that produces a {{String}}, much like 
{{ToStringBuilder}}. 
                
> There should be a DifferenceBuilder with a ReflectionDifferenceBuilder 
> implementation
> -------------------------------------------------------------------------------------
>
>                 Key: LANG-637
>                 URL: https://issues.apache.org/jira/browse/LANG-637
>             Project: Commons Lang
>          Issue Type: Improvement
>          Components: lang.builder.*
>            Reporter: Eric Lewis
>            Priority: Minor
>             Fix For: 3.x
>
>         Attachments: DifferenceBuilder.java, DifferenceBuilderTest.java, 
> Differentiable.java
>
>
> The ToStringBuilder and ReflectionToStringBuilder are great tools for 
> everyday development.
> We use them to show all the properties in an object, which comes handy 
> especially for testing.
> However, JUnit with its assertEquals() just outputs the toString() of the two 
> compared objects. For complex objects, this becomes unreadable.
> So, it would be great to have a DifferenceBuilder with a 
> ReflectionDifferenceBuilder implementation to be able to get only the 
> differing properties of two objects. The question is whether the two objects 
> would have to be of the same type or not.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to