[jira] [Work logged] (LANG-1490) Create a more generic/string representation of a DiffResult and a Diff

2020-05-31 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/LANG-1490?focusedWorklogId=439349=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-439349
 ]

ASF GitHub Bot logged work on LANG-1490:


Author: ASF GitHub Bot
Created on: 01/Jun/20 05:46
Start Date: 01/Jun/20 05:46
Worklog Time Spent: 10m 
  Work Description: kinow commented on a change in pull request #457:
URL: https://github.com/apache/commons-lang/pull/457#discussion_r433050850



##
File path: src/main/java/org/apache/commons/lang3/builder/DiffView.java
##
@@ -0,0 +1,64 @@
+package org.apache.commons.lang3.builder;

Review comment:
   I think this file is missing the copyright license header.

##
File path: src/main/java/org/apache/commons/lang3/builder/DiffView.java
##
@@ -0,0 +1,64 @@
+package org.apache.commons.lang3.builder;
+
+/**
+ * A {@code DiffView} object holds the string representation of the 
difference of
+ * a given field between two objects.
+ *
+ * @since 3.10
+ */
+public class DiffView {
+   private final String field;
+   private final String leftValue;
+   private final String rightValue;
+
+   /**
+* Constructs a {@code DiffView} from 3 string params: field, 
leftValue and rightValue
+*
+* @param field designates the field identified as different.
+* @param leftValue holds the string representation of the value in the 
left side of the comparison.
+* @param rightValue holds the string representation of the value in 
the right side of the comparison.
+*/
+   public DiffView(String field, String leftValue, String rightValue) {
+   this.field = field;

Review comment:
   I think the files were formatted with tabs, and this may cause issues in 
Travis when it builds using Checkstyle.

##
File path: src/main/java/org/apache/commons/lang3/builder/DiffResultView.java
##
@@ -0,0 +1,157 @@
+package org.apache.commons.lang3.builder;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * 
+ * A {@code DiffResultView} encapsulates two objects of the same type and list 
their differences
+ * as a list of {@link DiffView} objects, each holding a field name and the 
two different values found for this field
+ * in the Left and Right object.
+ * 
+ *
+ * 
+ * It can be built with or without a pre-defined list of {@link DiffView} 
objects, or from an existing
+ * {@link DiffResult}.
+ * 
+ *
+ * @param  type of the left and right object.
+ *
+ * @since 3.10
+ */
+public class DiffResultView {
+
+   /**
+* The list of {@link DiffView} objects for the two compared objects.
+*/
+   private List diffs;
+
+   /**
+* Holds the left object of the comparison.
+*/
+   private T left;
+   /**
+* Holds the right object of the comparison.
+*/
+   private T right;
+
+   /**
+* Creates a simple {@code DiffResultView} without predefined list 
of {@link DiffView}.
+* The list will be initialized as an empty @{link ArrayList}.
+*
+* @param o1 left object of the comparison
+* @param o2 right object of the comparison
+*/
+   public DiffResultView(T o1, T o2) {
+   this.left = o1;
+   this.right = o2;
+   this.diffs = new ArrayList<>();
+   }
+
+   /**
+* Creates a simple {@code DiffResultView} with a predefined list of 
{@link DiffView}.
+*
+* @param o1 left object of the comparison.
+* @param o2 right object of the comparison.
+* @param diffs list of {@link DiffView} objects.
+*/
+   public DiffResultView(T o1, T o2, List diffs) {
+   this(o1, o2);
+   this.diffs = diffs;
+   }
+
+   /**
+* Creates a simple {@code DiffResultView} from a {@link DiffResult} 
object.
+* {@link DiffView} objects will be constructed from {@link 
DiffResult} {@link Diff} objects and
+* added to the diffs list
+*
+* @param diffResult {@link DiffResult} object used to initialize the 
{@code DiffResultView}
+*/
+   public DiffResultView(DiffResult diffResult) {
+   this(diffResult.getLeft(), diffResult.getRight());
+   this.addDiffs(diffResult);
+   }
+
+   /**
+* Returns the list of the {@link DiffView} objects
+* @return the list of the {@link DiffView} objects
+*/
+   public List getDiffs() {
+   return diffs;
+   }
+
+   /**
+* Returns only a list of the fields of all {@link DiffView} 
objects, that is, fields that have been detected
+* as changed between the objects.
+*
+* @return the list of the {@link DiffView} objects
+*/
+   public List getDiffFields() {
+  

[jira] [Work logged] (LANG-1490) Create a more generic/string representation of a DiffResult and a Diff

2019-09-13 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/LANG-1490?focusedWorklogId=312183=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-312183
 ]

ASF GitHub Bot logged work on LANG-1490:


Author: ASF GitHub Bot
Created on: 13/Sep/19 17:13
Start Date: 13/Sep/19 17:13
Worklog Time Spent: 10m 
  Work Description: garydgregory commented on issue #457: WIP [LANG-1490] - 
Creates DiffResultView and DiffView classes
URL: https://github.com/apache/commons-lang/pull/457#issuecomment-531318800
 
 
   Let me take a closer look this weekend. In the meantime, I would also like 
to work on a patch that defines as `Diffable`:
   
   ```
   public interface Diffable>
   ```
   
   This will allow diffs on a class and one of its subclasses for example.
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 312183)
Time Spent: 1h  (was: 50m)

> Create a more generic/string representation of a DiffResult and a Diff
> --
>
> Key: LANG-1490
> URL: https://issues.apache.org/jira/browse/LANG-1490
> Project: Commons Lang
>  Issue Type: Wish
>Reporter: Nicolas BARTHE-DEJEAN
>Priority: Major
>  Time Spent: 1h
>  Remaining Estimate: 0h
>
> Currently, a DiffResult and a Diff can only handle the differences of two 
> objects of the same type A, and we cannot set custom differences for a 
> DiffResult if encapsulated objects of type B are different.
> I suggest to implement a `DiffView class` as a simple `String field`, `String 
> leftValue` and `String rightValue` triplet.
> I also wrote a `DiffResultView` class holding two objects of type `T` and a 
> list of `DiffView` objects.
> https://issues.apache.org/jira/browse/LANG-1490



--
This message was sent by Atlassian Jira
(v8.3.2#803003)


[jira] [Work logged] (LANG-1490) Create a more generic/string representation of a DiffResult and a Diff

2019-09-13 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/LANG-1490?focusedWorklogId=312132=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-312132
 ]

ASF GitHub Bot logged work on LANG-1490:


Author: ASF GitHub Bot
Created on: 13/Sep/19 15:24
Start Date: 13/Sep/19 15:24
Worklog Time Spent: 10m 
  Work Description: nicolasbd commented on issue #457: WIP [LANG-1490] - 
Creates DiffResultView and DiffView classes
URL: https://github.com/apache/commons-lang/pull/457#issuecomment-531279488
 
 
   @garydgregory ok I'll add it, but what do you think about the idea itself ? 
   
   I'll add proper headers and tests once we decide if this should be added to 
the lib 
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 312132)
Time Spent: 50m  (was: 40m)

> Create a more generic/string representation of a DiffResult and a Diff
> --
>
> Key: LANG-1490
> URL: https://issues.apache.org/jira/browse/LANG-1490
> Project: Commons Lang
>  Issue Type: Wish
>Reporter: Nicolas BARTHE-DEJEAN
>Priority: Major
>  Time Spent: 50m
>  Remaining Estimate: 0h
>
> Currently, a DiffResult and a Diff can only handle the differences of two 
> objects of the same type A, and we cannot set custom differences for a 
> DiffResult if encapsulated objects of type B are different.
> I suggest to implement a DiffView class as a simple `String field`, `String 
> leftValue` and `String rightValue` triplet.
> I also build a DiffResultView holding two objects of type T and a list of 
> DiffView objects.



--
This message was sent by Atlassian Jira
(v8.3.2#803003)


[jira] [Work logged] (LANG-1490) Create a more generic/string representation of a DiffResult and a Diff

2019-09-13 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/LANG-1490?focusedWorklogId=312126=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-312126
 ]

ASF GitHub Bot logged work on LANG-1490:


Author: ASF GitHub Bot
Created on: 13/Sep/19 15:18
Start Date: 13/Sep/19 15:18
Worklog Time Spent: 10m 
  Work Description: garydgregory commented on issue #457: WIP [LANG-1490] - 
Creates DiffResultView and DiffView classes
URL: https://github.com/apache/commons-lang/pull/457#issuecomment-531278986
 
 
   Hi @nicolasbd ,
   
   Both files are missing the Apache license header causing CI build failures: 
https://travis-ci.org/apache/commons-lang/builds/584638020?utm_source=github_status_medium=notification
   
   Gary
   
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 312126)
Time Spent: 0.5h  (was: 20m)

> Create a more generic/string representation of a DiffResult and a Diff
> --
>
> Key: LANG-1490
> URL: https://issues.apache.org/jira/browse/LANG-1490
> Project: Commons Lang
>  Issue Type: Wish
>Reporter: Nicolas BARTHE-DEJEAN
>Priority: Major
>  Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> Currently, a DiffResult and a Diff can only handle the differences of two 
> objects of the same type A, and we cannot set custom differences for a 
> DiffResult if encapsulated objects of type B are different.
> I suggest to implement a DiffView class as a simple `String field`, `String 
> leftValue` and `String rightValue` triplet.
> I also build a DiffResultView holding two objects of type T and a list of 
> DiffView objects.



--
This message was sent by Atlassian Jira
(v8.3.2#803003)


[jira] [Work logged] (LANG-1490) Create a more generic/string representation of a DiffResult and a Diff

2019-09-13 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/LANG-1490?focusedWorklogId=312127=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-312127
 ]

ASF GitHub Bot logged work on LANG-1490:


Author: ASF GitHub Bot
Created on: 13/Sep/19 15:18
Start Date: 13/Sep/19 15:18
Worklog Time Spent: 10m 
  Work Description: nicolasbd commented on issue #457: WIP [LANG-1490] - 
Creates DiffResultView and DiffView classes
URL: https://github.com/apache/commons-lang/pull/457#issuecomment-531279488
 
 
   @garydgregory ok, but what do you think about the idea itself ? 
   
   I'll add proper headers and tests once we decide if this should be added to 
the lib 
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 312127)
Time Spent: 40m  (was: 0.5h)

> Create a more generic/string representation of a DiffResult and a Diff
> --
>
> Key: LANG-1490
> URL: https://issues.apache.org/jira/browse/LANG-1490
> Project: Commons Lang
>  Issue Type: Wish
>Reporter: Nicolas BARTHE-DEJEAN
>Priority: Major
>  Time Spent: 40m
>  Remaining Estimate: 0h
>
> Currently, a DiffResult and a Diff can only handle the differences of two 
> objects of the same type A, and we cannot set custom differences for a 
> DiffResult if encapsulated objects of type B are different.
> I suggest to implement a DiffView class as a simple `String field`, `String 
> leftValue` and `String rightValue` triplet.
> I also build a DiffResultView holding two objects of type T and a list of 
> DiffView objects.



--
This message was sent by Atlassian Jira
(v8.3.2#803003)


[jira] [Work logged] (LANG-1490) Create a more generic/string representation of a DiffResult and a Diff

2019-09-13 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/LANG-1490?focusedWorklogId=312125=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-312125
 ]

ASF GitHub Bot logged work on LANG-1490:


Author: ASF GitHub Bot
Created on: 13/Sep/19 15:17
Start Date: 13/Sep/19 15:17
Worklog Time Spent: 10m 
  Work Description: garydgregory commented on issue #457: WIP [LANG-1490] - 
Creates DiffResultView and DiffView classes
URL: https://github.com/apache/commons-lang/pull/457#issuecomment-531278986
 
 
   Hi @nicolasbd ,
   
   Both files are missing the Apache license header.
   
   Gary
   
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 312125)
Time Spent: 20m  (was: 10m)

> Create a more generic/string representation of a DiffResult and a Diff
> --
>
> Key: LANG-1490
> URL: https://issues.apache.org/jira/browse/LANG-1490
> Project: Commons Lang
>  Issue Type: Wish
>Reporter: Nicolas BARTHE-DEJEAN
>Priority: Major
>  Time Spent: 20m
>  Remaining Estimate: 0h
>
> Currently, a DiffResult and a Diff can only handle the differences of two 
> objects of the same type A, and we cannot set custom differences for a 
> DiffResult if encapsulated objects of type B are different.
> I suggest to implement a DiffView class as a simple `String field`, `String 
> leftValue` and `String rightValue` triplet.
> I also build a DiffResultView holding two objects of type T and a list of 
> DiffView objects.



--
This message was sent by Atlassian Jira
(v8.3.2#803003)


[jira] [Work logged] (LANG-1490) Create a more generic/string representation of a DiffResult and a Diff

2019-09-13 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/LANG-1490?focusedWorklogId=312108=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-312108
 ]

ASF GitHub Bot logged work on LANG-1490:


Author: ASF GitHub Bot
Created on: 13/Sep/19 14:59
Start Date: 13/Sep/19 14:59
Worklog Time Spent: 10m 
  Work Description: nicolasbd commented on pull request #457: [LANG-1490] - 
Creates DiffResultView and DiffView classes
URL: https://github.com/apache/commons-lang/pull/457
 
 
   Currently, a DiffResult and a Diff can only handle the differences of two 
objects of the same type A, and we cannot set custom differences for a 
DiffResult if encapsulated objects of type B are different.
   
   I suggest to implement a DiffView class as a simple `String field`, `String 
leftValue` and `String rightValue` triplet. 
   
   I also build a DiffResultView holding two objects of type T and a list of 
DiffView objects.
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 312108)
Remaining Estimate: 0h
Time Spent: 10m

> Create a more generic/string representation of a DiffResult and a Diff
> --
>
> Key: LANG-1490
> URL: https://issues.apache.org/jira/browse/LANG-1490
> Project: Commons Lang
>  Issue Type: Wish
>Reporter: Nicolas BARTHE-DEJEAN
>Priority: Major
>  Time Spent: 10m
>  Remaining Estimate: 0h
>
> Currently, a DiffResult and a Diff can only handle the differences of two 
> objects of the same type A, and we cannot set custom differences for a 
> DiffResult if encapsulated objects of type B are different.
> I will implement a DiffView class as a simple String key, String leftVal and 
> String rightVal triplet. 
> I will also build a DiffResultView holding two objects and a list of DiffView 
> objects



--
This message was sent by Atlassian Jira
(v8.3.2#803003)