You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by sebb <se...@gmail.com> on 2019/09/06 16:31:20 UTC

[LANG] About Diffable, DiffBuilder, and DiffResult

[Added component prefix]

On Fri, 6 Sep 2019 at 16:20, Nicolas BD <ni...@gmail.com> wrote:
>
> Hi all,
>
> TL;DR : I think we should be able to add arbitrary diffs to a diff result,
> not only those related to its type fields. We could create a class allowing
> us to store a Diff as a simple "key", "val1", "val2" triplet
>
> I'm new to this list and just made a small addition to one of the classes
> of the Lang module, the DiffResult class, following my JIRA Ticket :
> https://issues.apache.org/jira/browse/LANG-1485
>
> After this, Gary Gregory had the same idea as me : we could generify the
> builder classes, and pushed this as an improvement described in the
> following ticket : https://issues.apache.org/jira/browse/LANG-1486
>
> But I just realized something :
> - I'm using a DiffBuilder outside of any class (I'm not making my classes
> implement Diffable since we want to keep my models clear - that's a team
> decision),
> - I give it two objects of type A that contain one object of type B each,
> - I want to add *several* diffs to my objects A according to the fields of
> their B objects that are different.
> - That seem impossible right now, will probably be even more difficult with
> a type-defined DiffBuilder and DiffResult
>
> Here is a more concrete example :
> - I have Trains that have some simple fields (like their number or date)
> - But they also have some kind of Journey field containing many Stops :
> - I want to be able to add as many diffs to my train diff as there are
> diffs in my Stops objects.
> (my model is really more complex than this, but I think this fits my need
> for explanation)
>
> I surely can use a DiffBuilder for each pair of Stops (from left and right
> train), but I'm unable to add them to the Train DiffResult since it's not
> the same type.
>
> Considering that a DiffResult is the literally the Result of a Diff of two
> objects of the same type, that's totally normal.
>
> But it could be useful to create a class allowing us to store a Diff as a
> simple "key", "val1", "val2" triplet. They could all be either generically
> typed or dare I say, Strings .. ?
>
> What do you guys think ?
>
> Thanks
>
> Nicolas

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


Re: [LANG] About Diffable, DiffBuilder, and DiffResult

Posted by Nicolas BD <ni...@gmail.com>.
What I can do is to implement a DiffView class as a simple String key,
String leftVal and String rightVal triplet and implement a toString method
there.
We will then see if it’s relevant to add it to the lib or not

Le ven. 6 sept. 2019 à 18:31, sebb <se...@gmail.com> a écrit :

> [Added component prefix]
>
> On Fri, 6 Sep 2019 at 16:20, Nicolas BD <ni...@gmail.com> wrote:
> >
> > Hi all,
> >
> > TL;DR : I think we should be able to add arbitrary diffs to a diff
> result,
> > not only those related to its type fields. We could create a class
> allowing
> > us to store a Diff as a simple "key", "val1", "val2" triplet
> >
> > I'm new to this list and just made a small addition to one of the classes
> > of the Lang module, the DiffResult class, following my JIRA Ticket :
> > https://issues.apache.org/jira/browse/LANG-1485
> >
> > After this, Gary Gregory had the same idea as me : we could generify the
> > builder classes, and pushed this as an improvement described in the
> > following ticket : https://issues.apache.org/jira/browse/LANG-1486
> >
> > But I just realized something :
> > - I'm using a DiffBuilder outside of any class (I'm not making my classes
> > implement Diffable since we want to keep my models clear - that's a team
> > decision),
> > - I give it two objects of type A that contain one object of type B each,
> > - I want to add *several* diffs to my objects A according to the fields
> of
> > their B objects that are different.
> > - That seem impossible right now, will probably be even more difficult
> with
> > a type-defined DiffBuilder and DiffResult
> >
> > Here is a more concrete example :
> > - I have Trains that have some simple fields (like their number or date)
> > - But they also have some kind of Journey field containing many Stops :
> > - I want to be able to add as many diffs to my train diff as there are
> > diffs in my Stops objects.
> > (my model is really more complex than this, but I think this fits my need
> > for explanation)
> >
> > I surely can use a DiffBuilder for each pair of Stops (from left and
> right
> > train), but I'm unable to add them to the Train DiffResult since it's not
> > the same type.
> >
> > Considering that a DiffResult is the literally the Result of a Diff of
> two
> > objects of the same type, that's totally normal.
> >
> > But it could be useful to create a class allowing us to store a Diff as a
> > simple "key", "val1", "val2" triplet. They could all be either
> generically
> > typed or dare I say, Strings .. ?
> >
> > What do you guys think ?
> >
> > Thanks
> >
> > Nicolas
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>
>