[jira] [Work logged] (LANG-1662) Create methods on ReflectionToStringBuilder to reflect only select fields
[ https://issues.apache.org/jira/browse/LANG-1662?focusedWorklogId=788029=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-788029 ] ASF GitHub Bot logged work on LANG-1662: Author: ASF GitHub Bot Created on: 05/Jul/22 19:32 Start Date: 05/Jul/22 19:32 Worklog Time Spent: 10m Work Description: GutoVeronezi commented on PR #849: URL: https://github.com/apache/commons-lang/pull/849#issuecomment-1175422840 @garydgregory, when the `ReflectionToStringBuilder` is instantiated, the object is added to the `ToStringStyle#REGISTRY` and is removed from it when calling `ToStringBuilder#toString()`. As we have both include and exclude fields now, we are validating if there is intersection between them. Previous these last changes, if there was intersection, an exception was being thrown and the object was not being removed from the `REGISTRY`. If the tests expecting the exception were being executed firstly, and as `ToStringStyle#REGISTRY` is static, it would never be empty, broking the other tests. To fix this situation, I made the validation code block unregister the object before throwing the exception, to honor the current workflow. I also moved the block that validates the intersection to a more convenient flow. I extended `AbstractLangBuilderTest` in the test class, as you requested. Issue Time Tracking --- Worklog Id: (was: 788029) Remaining Estimate: 3h 10m (was: 3h 20m) Time Spent: 2h 50m (was: 2h 40m) > Create methods on ReflectionToStringBuilder to reflect only select fields > - > > Key: LANG-1662 > URL: https://issues.apache.org/jira/browse/LANG-1662 > Project: Commons Lang > Issue Type: Improvement > Components: lang.builder.* >Reporter: Daniel Augusto Veronezi Salvador >Priority: Minor > Original Estimate: 6h > Time Spent: 2h 50m > Remaining Estimate: 3h 10m > > *ReflectionToStringBuilder* has methods to exclude fields from *toString*; If > we have an object with several fields and want to reflect only a fews, we > have to list all the fields that we don't want to reflect and pass to > *excludeFieldNames*. > Would be valid implement a way to pass the fields that we want and reflect > only the selected fields? > > -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Work logged] (LANG-1662) Create methods on ReflectionToStringBuilder to reflect only select fields
[ https://issues.apache.org/jira/browse/LANG-1662?focusedWorklogId=788013=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-788013 ] ASF GitHub Bot logged work on LANG-1662: Author: ASF GitHub Bot Created on: 05/Jul/22 18:54 Start Date: 05/Jul/22 18:54 Worklog Time Spent: 10m Work Description: codecov-commenter commented on PR #849: URL: https://github.com/apache/commons-lang/pull/849#issuecomment-1175394383 # [Codecov](https://codecov.io/gh/apache/commons-lang/pull/849?src=pr=h1_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation) Report > Merging [#849](https://codecov.io/gh/apache/commons-lang/pull/849?src=pr=desc_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation) (1e8b9de) into [master](https://codecov.io/gh/apache/commons-lang/commit/1bf7d7ec12fa143a1b544cf2dd1a0c1a8de7548a?el=desc_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation) (1bf7d7e) will **increase** coverage by `0.00%`. > The diff coverage is `94.73%`. ```diff @@Coverage Diff@@ ## master #849 +/- ## = Coverage 91.71% 91.72% - Complexity 7408 7422 +14 = Files 188 188 Lines 1590015928 +28 Branches 2994 3000+6 = + Hits 1458314610 +27 - Misses 725 726+1 Partials592 592 ``` | [Impacted Files](https://codecov.io/gh/apache/commons-lang/pull/849?src=pr=tree_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation) | Coverage Δ | | |---|---|---| | [...mmons/lang3/builder/ReflectionToStringBuilder.java](https://codecov.io/gh/apache/commons-lang/pull/849/diff?src=pr=tree_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation#diff-c3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2NvbW1vbnMvbGFuZzMvYnVpbGRlci9SZWZsZWN0aW9uVG9TdHJpbmdCdWlsZGVyLmphdmE=) | `91.96% <94.73%> (+0.56%)` | :arrow_up: | | [...in/java/org/apache/commons/lang3/BooleanUtils.java](https://codecov.io/gh/apache/commons-lang/pull/849/diff?src=pr=tree_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation#diff-c3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2NvbW1vbnMvbGFuZzMvQm9vbGVhblV0aWxzLmphdmE=) | `94.82% <0.00%> (+0.28%)` | :arrow_up: | -- [Continue to review full report at Codecov](https://codecov.io/gh/apache/commons-lang/pull/849?src=pr=continue_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation). > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation) > `Δ = absolute (impact)`, `ø = not affected`, `? = missing data` > Powered by [Codecov](https://codecov.io/gh/apache/commons-lang/pull/849?src=pr=footer_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation). Last update [1bf7d7e...1e8b9de](https://codecov.io/gh/apache/commons-lang/pull/849?src=pr=lastupdated_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation). Issue Time Tracking --- Worklog Id: (was: 788013) Remaining Estimate: 3h 20m (was: 3.5h) Time Spent: 2h 40m (was: 2.5h) > Create methods on ReflectionToStringBuilder to reflect only select fields > - > > Key: LANG-1662 > URL: https://issues.apache.org/jira/browse/LANG-1662 > Project: Commons Lang > Issue Type: Improvement > Components: lang.builder.* >Reporter: Daniel Augusto Veronezi Salvador >Priority: Minor > Original Estimate: 6h > Time Spent: 2h 40m > Remaining Estimate: 3h 20m > > *ReflectionToStringBuilder* has methods to exclude fields from *toString*; If > we have an object with several fields and want to reflect only a fews, we > have to list all the fields that we don't want to reflect and pass to > *excludeFieldNames*. > Would be valid implement a way to pass the fields that we want and reflect > only the selected fields? >
[jira] [Work logged] (LANG-1662) Create methods on ReflectionToStringBuilder to reflect only select fields
[ https://issues.apache.org/jira/browse/LANG-1662?focusedWorklogId=787927=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-787927 ] ASF GitHub Bot logged work on LANG-1662: Author: ASF GitHub Bot Created on: 05/Jul/22 16:11 Start Date: 05/Jul/22 16:11 Worklog Time Spent: 10m Work Description: garydgregory commented on PR #849: URL: https://github.com/apache/commons-lang/pull/849#issuecomment-1175237551 When I apply the patch locally and run the Maven build from the command line, I get failures because it seems like the test order matters: ``` [ERROR] org.apache.commons.lang3.builder.ToStringBuilderTest.testDoubleArray Time elapsed: 0.001 s <<< FAILURE! org.opentest4j.AssertionFailedError: Expected null, actual: {org.apache.commons.lang3.builder.ReflectionToStringBuilderIncludeTest$TestFeature@58e9cc9a=null, org.apache.commons.lang3.builder.ReflectionToStringBuil derIncludeTest$TestFeature@7dca6126=null} ==> expected: but was: <{org.apache.commons.lang3.builder.ReflectionToStringBuilderIncludeTest$TestFeature@58e9cc9a=null, org.apache.commons.lang3.builder.Reflectio nToStringBuilderIncludeTest$TestFeature@7dca6126=null}> at org.junit.jupiter.api.AssertionUtils.fail(AssertionUtils.java:55) at org.junit.jupiter.api.AssertNull.failNotNull(AssertNull.java:54) at org.junit.jupiter.api.AssertNull.assertNull(AssertNull.java:38) ``` Issue Time Tracking --- Worklog Id: (was: 787927) Remaining Estimate: 3.5h (was: 3h 40m) Time Spent: 2.5h (was: 2h 20m) > Create methods on ReflectionToStringBuilder to reflect only select fields > - > > Key: LANG-1662 > URL: https://issues.apache.org/jira/browse/LANG-1662 > Project: Commons Lang > Issue Type: Improvement > Components: lang.builder.* >Reporter: Daniel Augusto Veronezi Salvador >Priority: Minor > Original Estimate: 6h > Time Spent: 2.5h > Remaining Estimate: 3.5h > > *ReflectionToStringBuilder* has methods to exclude fields from *toString*; If > we have an object with several fields and want to reflect only a fews, we > have to list all the fields that we don't want to reflect and pass to > *excludeFieldNames*. > Would be valid implement a way to pass the fields that we want and reflect > only the selected fields? > > -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Work logged] (LANG-1662) Create methods on ReflectionToStringBuilder to reflect only select fields
[ https://issues.apache.org/jira/browse/LANG-1662?focusedWorklogId=768577=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-768577 ] ASF GitHub Bot logged work on LANG-1662: Author: ASF GitHub Bot Created on: 10/May/22 16:42 Start Date: 10/May/22 16:42 Worklog Time Spent: 10m Work Description: GutoVeronezi commented on PR #849: URL: https://github.com/apache/commons-lang/pull/849#issuecomment-1122632501 Hi, can anyone else review this PR? Best regards, Daniel Issue Time Tracking --- Worklog Id: (was: 768577) Remaining Estimate: 3h 40m (was: 3h 50m) Time Spent: 2h 20m (was: 2h 10m) > Create methods on ReflectionToStringBuilder to reflect only select fields > - > > Key: LANG-1662 > URL: https://issues.apache.org/jira/browse/LANG-1662 > Project: Commons Lang > Issue Type: Improvement > Components: lang.builder.* >Reporter: Daniel Augusto Veronezi Salvador >Priority: Minor > Original Estimate: 6h > Time Spent: 2h 20m > Remaining Estimate: 3h 40m > > *ReflectionToStringBuilder* has methods to exclude fields from *toString*; If > we have an object with several fields and want to reflect only a fews, we > have to list all the fields that we don't want to reflect and pass to > *excludeFieldNames*. > Would be valid implement a way to pass the fields that we want and reflect > only the selected fields? > > -- This message was sent by Atlassian Jira (v8.20.7#820007)
[jira] [Work logged] (LANG-1662) Create methods on ReflectionToStringBuilder to reflect only select fields
[ https://issues.apache.org/jira/browse/LANG-1662?focusedWorklogId=759660=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-759660 ] ASF GitHub Bot logged work on LANG-1662: Author: ASF GitHub Bot Created on: 21/Apr/22 00:04 Start Date: 21/Apr/22 00:04 Worklog Time Spent: 10m Work Description: GutoVeronezi commented on PR #849: URL: https://github.com/apache/commons-lang/pull/849#issuecomment-1104565683 Hi, @kinow, Thanks for the review. I fixed the bug with the exception and added more unit tests. I couldn't think in many other situations to validate; therefore, if you think in other use cases, just let me know and I create the tests. Best regards, Daniel Issue Time Tracking --- Worklog Id: (was: 759660) Remaining Estimate: 3h 50m (was: 4h) Time Spent: 2h 10m (was: 2h) > Create methods on ReflectionToStringBuilder to reflect only select fields > - > > Key: LANG-1662 > URL: https://issues.apache.org/jira/browse/LANG-1662 > Project: Commons Lang > Issue Type: Improvement > Components: lang.builder.* >Reporter: Daniel Augusto Veronezi Salvador >Priority: Minor > Original Estimate: 6h > Time Spent: 2h 10m > Remaining Estimate: 3h 50m > > *ReflectionToStringBuilder* has methods to exclude fields from *toString*; If > we have an object with several fields and want to reflect only a fews, we > have to list all the fields that we don't want to reflect and pass to > *excludeFieldNames*. > Would be valid implement a way to pass the fields that we want and reflect > only the selected fields? > > -- This message was sent by Atlassian Jira (v8.20.7#820007)
[jira] [Work logged] (LANG-1662) Create methods on ReflectionToStringBuilder to reflect only select fields
[ https://issues.apache.org/jira/browse/LANG-1662?focusedWorklogId=755636=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-755636 ] ASF GitHub Bot logged work on LANG-1662: Author: ASF GitHub Bot Created on: 12/Apr/22 08:20 Start Date: 12/Apr/22 08:20 Worklog Time Spent: 10m Work Description: kinow commented on code in PR #849: URL: https://github.com/apache/commons-lang/pull/849#discussion_r848110734 ## src/main/java/org/apache/commons/lang3/builder/ReflectionToStringBuilder.java: ## @@ -460,6 +490,11 @@ private static Object checkNotNull(final Object obj) { */ protected String[] excludeFieldNames; +/** + * Field names that will be include in the output. All fields are included by default. Review Comment: s/will be include/will be included Issue Time Tracking --- Worklog Id: (was: 755636) Remaining Estimate: 4h (was: 4h 10m) Time Spent: 2h (was: 1h 50m) > Create methods on ReflectionToStringBuilder to reflect only select fields > - > > Key: LANG-1662 > URL: https://issues.apache.org/jira/browse/LANG-1662 > Project: Commons Lang > Issue Type: Improvement > Components: lang.builder.* >Reporter: Daniel Augusto Veronezi Salvador >Priority: Minor > Original Estimate: 6h > Time Spent: 2h > Remaining Estimate: 4h > > *ReflectionToStringBuilder* has methods to exclude fields from *toString*; If > we have an object with several fields and want to reflect only a fews, we > have to list all the fields that we don't want to reflect and pass to > *excludeFieldNames*. > Would be valid implement a way to pass the fields that we want and reflect > only the selected fields? > > -- This message was sent by Atlassian Jira (v8.20.1#820001)
[jira] [Work logged] (LANG-1662) Create methods on ReflectionToStringBuilder to reflect only select fields
[ https://issues.apache.org/jira/browse/LANG-1662?focusedWorklogId=745671=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-745671 ] ASF GitHub Bot logged work on LANG-1662: Author: ASF GitHub Bot Created on: 22/Mar/22 09:22 Start Date: 22/Mar/22 09:22 Worklog Time Spent: 10m Work Description: garydgregory commented on pull request #849: URL: https://github.com/apache/commons-lang/pull/849#issuecomment-1074923276 Hi @GutoVeronezi You did not answer my question. See my code example; it should be one of your unit tests. I do not know (yet) what would be reasonable as the behavior. @kinow , any thoughts? -- 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. To unsubscribe, e-mail: issues-unsubscr...@commons.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking --- Worklog Id: (was: 745671) Remaining Estimate: 4h 10m (was: 4h 20m) Time Spent: 1h 50m (was: 1h 40m) > Create methods on ReflectionToStringBuilder to reflect only select fields > - > > Key: LANG-1662 > URL: https://issues.apache.org/jira/browse/LANG-1662 > Project: Commons Lang > Issue Type: Improvement > Components: lang.builder.* >Reporter: Daniel Augusto Veronezi Salvador >Priority: Minor > Original Estimate: 6h > Time Spent: 1h 50m > Remaining Estimate: 4h 10m > > *ReflectionToStringBuilder* has methods to exclude fields from *toString*; If > we have an object with several fields and want to reflect only a fews, we > have to list all the fields that we don't want to reflect and pass to > *excludeFieldNames*. > Would be valid implement a way to pass the fields that we want and reflect > only the selected fields? > > -- This message was sent by Atlassian Jira (v8.20.1#820001)
[jira] [Work logged] (LANG-1662) Create methods on ReflectionToStringBuilder to reflect only select fields
[ https://issues.apache.org/jira/browse/LANG-1662?focusedWorklogId=745445=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-745445 ] ASF GitHub Bot logged work on LANG-1662: Author: ASF GitHub Bot Created on: 21/Mar/22 21:31 Start Date: 21/Mar/22 21:31 Worklog Time Spent: 10m Work Description: GutoVeronezi commented on pull request #849: URL: https://github.com/apache/commons-lang/pull/849#issuecomment-1074440685 Hi, @garydgregory, Thanks for the review, I'll address the changes regarding the feature name (`setSelectedFieldNames` -> `setIncludeFieldNames`) as well the documentation of its use. --- Regarding the intersection between `included` and `excluded`, I see it as a complement rather than an intersection; The current behavior of this class, as you said, is to include all fields by default. If we have a class with fields `a`, `b` and `c` and instantiate and reflect it, both of them will be reflected. If we set them in the excluded field names, the reflection will return empty: ```java import org.apache.commons.lang3.builder.ReflectionToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; public class Test { private String a; private String b; private String c; public Test(String a, String b, String c) { this.a = a; this.b = b; this.c = c; } public static void main(String[] args) { Test test = new Test("this is field 'a'", "this is field 'b'", "this is field 'c'"); ReflectionToStringBuilder reflection = new ReflectionToStringBuilder(test, ToStringStyle.JSON_STYLE); System.out.println(String.format("Before excluding: %s", reflection.build())); reflection = new ReflectionToStringBuilder(test, ToStringStyle.JSON_STYLE); // Recreating the object because once builded it caches the result. reflection.setExcludeFieldNames("a", "b", "c"); System.out.println(String.format("After excluding: %s", reflection.build())); } ``` Result: ``` Before excluding: {"a":"this is field 'a'","b":"this is field 'b'","c":"this is field 'c'"} After excluding: {} ``` In this example we're creating a complement of `excluded` (fields `a`, `b` and `c`) regarding set `included` (the default fields `a`, `b` and `c`), which will result in an empty set, or, in other words, nothing to reflect. The behavior per se will be the same, however, with this proposal, we'll be able to override the `included` set. Therefore, I think instead of throwing an exception, we should add an explanation in the documentation about it and let the users decide how to handle it. If this is proposal is not valid and we proceed with the exception proposal, which cases should we consider to throw it? `included` and `excluded` are equal or just by having one field of `included` in `excluded` should throw an exception? -- 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. To unsubscribe, e-mail: issues-unsubscr...@commons.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking --- Worklog Id: (was: 745445) Remaining Estimate: 4h 20m (was: 4.5h) Time Spent: 1h 40m (was: 1.5h) > Create methods on ReflectionToStringBuilder to reflect only select fields > - > > Key: LANG-1662 > URL: https://issues.apache.org/jira/browse/LANG-1662 > Project: Commons Lang > Issue Type: Improvement > Components: lang.builder.* >Reporter: Daniel Augusto Veronezi Salvador >Priority: Minor > Original Estimate: 6h > Time Spent: 1h 40m > Remaining Estimate: 4h 20m > > *ReflectionToStringBuilder* has methods to exclude fields from *toString*; If > we have an object with several fields and want to reflect only a fews, we > have to list all the fields that we don't want to reflect and pass to > *excludeFieldNames*. > Would be valid implement a way to pass the fields that we want and reflect > only the selected fields? > > -- This message was sent by Atlassian Jira (v8.20.1#820001)
[jira] [Work logged] (LANG-1662) Create methods on ReflectionToStringBuilder to reflect only select fields
[ https://issues.apache.org/jira/browse/LANG-1662?focusedWorklogId=737161=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-737161 ] ASF GitHub Bot logged work on LANG-1662: Author: ASF GitHub Bot Created on: 05/Mar/22 18:45 Start Date: 05/Mar/22 18:45 Worklog Time Spent: 10m Work Description: garydgregory edited a comment on pull request #849: URL: https://github.com/apache/commons-lang/pull/849#issuecomment-1059813450 Hello @GutoVeronezi Thank you for your PR. The name `setSelectedFieldNames1 is confusing because it is not symmetric (for lack of a better word) with `setExcludeFieldNames`, I think it would be best as `setIncludeFieldNames` which then is a bit odd since ALL fields are included by default, so there should be _clear_ documentation that using `setIncludeFieldNames` overrides this default behavior. The following behavior should throw an `IllegalStateException` IMO: ``` ReflectionToStringBuilder reflectionToStringBuilder = new ReflectionToStringBuilder(example, ToStringStyle.JSON_STYLE); reflectionToStringBuilder.setIncludedFieldNames("a", "b", "e"); reflectionToStringBuilder.setExcludedFieldNames("a", "b", "e"); // throws IllegalStateException? System.out.println(reflectionToStringBuilder.build()); // throws IllegalStateException? ``` IOW what does it mean to set a field as both included and excluded? Does the "last API call win" or, does the code simply throw an `IllegalStateException` if the includes and excludes set intersect? -- 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. To unsubscribe, e-mail: issues-unsubscr...@commons.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking --- Worklog Id: (was: 737161) Remaining Estimate: 4.5h (was: 4h 40m) Time Spent: 1.5h (was: 1h 20m) > Create methods on ReflectionToStringBuilder to reflect only select fields > - > > Key: LANG-1662 > URL: https://issues.apache.org/jira/browse/LANG-1662 > Project: Commons Lang > Issue Type: Improvement > Components: lang.builder.* >Reporter: Daniel Augusto Veronezi Salvador >Priority: Minor > Original Estimate: 6h > Time Spent: 1.5h > Remaining Estimate: 4.5h > > *ReflectionToStringBuilder* has methods to exclude fields from *toString*; If > we have an object with several fields and want to reflect only a fews, we > have to list all the fields that we don't want to reflect and pass to > *excludeFieldNames*. > Would be valid implement a way to pass the fields that we want and reflect > only the selected fields? > > -- This message was sent by Atlassian Jira (v8.20.1#820001)
[jira] [Work logged] (LANG-1662) Create methods on ReflectionToStringBuilder to reflect only select fields
[ https://issues.apache.org/jira/browse/LANG-1662?focusedWorklogId=737160=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-737160 ] ASF GitHub Bot logged work on LANG-1662: Author: ASF GitHub Bot Created on: 05/Mar/22 18:44 Start Date: 05/Mar/22 18:44 Worklog Time Spent: 10m Work Description: garydgregory commented on pull request #849: URL: https://github.com/apache/commons-lang/pull/849#issuecomment-1059813450 Hello @GutoVeronezi Thank you for your PR. The name `setSelectedFieldNames1 is confusing because it is not symmetric (for lack of a better word) with `setExcludeFieldNames`, I think it would be best as `setIncludeFieldNames` which then is a bit odd since ALL fields are included by default, so there should be _clear_ documentation that using `setIncludeFieldNames` overrides this default behavior. The following behavior should throw an `IllegalStateException` IMO: ``` ReflectionToStringBuilder reflectionToStringBuilder = new ReflectionToStringBuilder(example, ToStringStyle.JSON_STYLE); reflectionToStringBuilder.setIncludedFieldNames("a", "b", "e"); reflectionToStringBuilder.setExcludedFieldNames("a", "b", "e"); // throws IllegalStateException? System.out.println(reflectionToStringBuilder.build()); // throws IllegalStateException? ``` IOW what does it mean to set a field as both included and excluded, does the "last API call win" or, does the code simply throw an `IllegalStateException` if the include and exclude set intersect? -- 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. To unsubscribe, e-mail: issues-unsubscr...@commons.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking --- Worklog Id: (was: 737160) Remaining Estimate: 4h 40m (was: 4h 50m) Time Spent: 1h 20m (was: 1h 10m) > Create methods on ReflectionToStringBuilder to reflect only select fields > - > > Key: LANG-1662 > URL: https://issues.apache.org/jira/browse/LANG-1662 > Project: Commons Lang > Issue Type: Improvement > Components: lang.builder.* >Reporter: Daniel Augusto Veronezi Salvador >Priority: Minor > Original Estimate: 6h > Time Spent: 1h 20m > Remaining Estimate: 4h 40m > > *ReflectionToStringBuilder* has methods to exclude fields from *toString*; If > we have an object with several fields and want to reflect only a fews, we > have to list all the fields that we don't want to reflect and pass to > *excludeFieldNames*. > Would be valid implement a way to pass the fields that we want and reflect > only the selected fields? > > -- This message was sent by Atlassian Jira (v8.20.1#820001)
[jira] [Work logged] (LANG-1662) Create methods on ReflectionToStringBuilder to reflect only select fields
[ https://issues.apache.org/jira/browse/LANG-1662?focusedWorklogId=733825=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-733825 ] ASF GitHub Bot logged work on LANG-1662: Author: ASF GitHub Bot Created on: 28/Feb/22 12:49 Start Date: 28/Feb/22 12:49 Worklog Time Spent: 10m Work Description: GutoVeronezi commented on pull request #849: URL: https://github.com/apache/commons-lang/pull/849#issuecomment-1054224115 Thanks, @garydgregory. -- 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. To unsubscribe, e-mail: issues-unsubscr...@commons.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking --- Worklog Id: (was: 733825) Remaining Estimate: 4h 50m (was: 5h) Time Spent: 1h 10m (was: 1h) > Create methods on ReflectionToStringBuilder to reflect only select fields > - > > Key: LANG-1662 > URL: https://issues.apache.org/jira/browse/LANG-1662 > Project: Commons Lang > Issue Type: Improvement > Components: lang.builder.* >Reporter: Daniel Augusto Veronezi Salvador >Priority: Minor > Original Estimate: 6h > Time Spent: 1h 10m > Remaining Estimate: 4h 50m > > *ReflectionToStringBuilder* has methods to exclude fields from *toString*; If > we have an object with several fields and want to reflect only a fews, we > have to list all the fields that we don't want to reflect and pass to > *excludeFieldNames*. > Would be valid implement a way to pass the fields that we want and reflect > only the selected fields? > > -- This message was sent by Atlassian Jira (v8.20.1#820001)
[jira] [Work logged] (LANG-1662) Create methods on ReflectionToStringBuilder to reflect only select fields
[ https://issues.apache.org/jira/browse/LANG-1662?focusedWorklogId=733821=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-733821 ] ASF GitHub Bot logged work on LANG-1662: Author: ASF GitHub Bot Created on: 28/Feb/22 12:40 Start Date: 28/Feb/22 12:40 Worklog Time Spent: 10m Work Description: garydgregory commented on pull request #849: URL: https://github.com/apache/commons-lang/pull/849#issuecomment-1054216153 I will review later in the week. -- 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. To unsubscribe, e-mail: issues-unsubscr...@commons.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking --- Worklog Id: (was: 733821) Remaining Estimate: 5h (was: 5h 10m) Time Spent: 1h (was: 50m) > Create methods on ReflectionToStringBuilder to reflect only select fields > - > > Key: LANG-1662 > URL: https://issues.apache.org/jira/browse/LANG-1662 > Project: Commons Lang > Issue Type: Improvement > Components: lang.builder.* >Reporter: Daniel Augusto Veronezi Salvador >Priority: Minor > Original Estimate: 6h > Time Spent: 1h > Remaining Estimate: 5h > > *ReflectionToStringBuilder* has methods to exclude fields from *toString*; If > we have an object with several fields and want to reflect only a fews, we > have to list all the fields that we don't want to reflect and pass to > *excludeFieldNames*. > Would be valid implement a way to pass the fields that we want and reflect > only the selected fields? > > -- This message was sent by Atlassian Jira (v8.20.1#820001)
[jira] [Work logged] (LANG-1662) Create methods on ReflectionToStringBuilder to reflect only select fields
[ https://issues.apache.org/jira/browse/LANG-1662?focusedWorklogId=733814=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-733814 ] ASF GitHub Bot logged work on LANG-1662: Author: ASF GitHub Bot Created on: 28/Feb/22 12:08 Start Date: 28/Feb/22 12:08 Worklog Time Spent: 10m Work Description: GutoVeronezi commented on pull request #849: URL: https://github.com/apache/commons-lang/pull/849#issuecomment-1054191162 Could anyone review this PR? -- 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. To unsubscribe, e-mail: issues-unsubscr...@commons.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking --- Worklog Id: (was: 733814) Remaining Estimate: 5h 10m (was: 5h 20m) Time Spent: 50m (was: 40m) > Create methods on ReflectionToStringBuilder to reflect only select fields > - > > Key: LANG-1662 > URL: https://issues.apache.org/jira/browse/LANG-1662 > Project: Commons Lang > Issue Type: Improvement > Components: lang.builder.* >Reporter: Daniel Augusto Veronezi Salvador >Priority: Minor > Original Estimate: 6h > Time Spent: 50m > Remaining Estimate: 5h 10m > > *ReflectionToStringBuilder* has methods to exclude fields from *toString*; If > we have an object with several fields and want to reflect only a fews, we > have to list all the fields that we don't want to reflect and pass to > *excludeFieldNames*. > Would be valid implement a way to pass the fields that we want and reflect > only the selected fields? > > -- This message was sent by Atlassian Jira (v8.20.1#820001)
[jira] [Work logged] (LANG-1662) Create methods on ReflectionToStringBuilder to reflect only select fields
[ https://issues.apache.org/jira/browse/LANG-1662?focusedWorklogId=713050=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-713050 ] ASF GitHub Bot logged work on LANG-1662: Author: ASF GitHub Bot Created on: 21/Jan/22 19:43 Start Date: 21/Jan/22 19:43 Worklog Time Spent: 10m Work Description: rafaelweingartner commented on a change in pull request #849: URL: https://github.com/apache/commons-lang/pull/849#discussion_r789948481 ## File path: src/main/java/org/apache/commons/lang3/builder/ReflectionToStringBuilder.java ## @@ -385,6 +385,19 @@ public static String toStringExclude(final Object object, final Collection Create methods on ReflectionToStringBuilder to reflect only select fields > - > > Key: LANG-1662 > URL: https://issues.apache.org/jira/browse/LANG-1662 > Project: Commons Lang > Issue Type: Improvement > Components: lang.builder.* >Reporter: Daniel Augusto Veronezi Salvador >Priority: Minor > Original Estimate: 6h > Time Spent: 40m > Remaining Estimate: 5h 20m > > *ReflectionToStringBuilder* has methods to exclude fields from *toString*; If > we have an object with several fields and want to reflect only a fews, we > have to list all the fields that we don't want to reflect and pass to > *excludeFieldNames*. > Would be valid implement a way to pass the fields that we want and reflect > only the selected fields? > > -- This message was sent by Atlassian Jira (v8.20.1#820001)
[jira] [Work logged] (LANG-1662) Create methods on ReflectionToStringBuilder to reflect only select fields
[ https://issues.apache.org/jira/browse/LANG-1662?focusedWorklogId=713049=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-713049 ] ASF GitHub Bot logged work on LANG-1662: Author: ASF GitHub Bot Created on: 21/Jan/22 19:41 Start Date: 21/Jan/22 19:41 Worklog Time Spent: 10m Work Description: GutoVeronezi commented on a change in pull request #849: URL: https://github.com/apache/commons-lang/pull/849#discussion_r789947238 ## File path: src/main/java/org/apache/commons/lang3/builder/ReflectionToStringBuilder.java ## @@ -385,6 +385,19 @@ public static String toStringExclude(final Object object, final Collection Create methods on ReflectionToStringBuilder to reflect only select fields > - > > Key: LANG-1662 > URL: https://issues.apache.org/jira/browse/LANG-1662 > Project: Commons Lang > Issue Type: Improvement > Components: lang.builder.* >Reporter: Daniel Augusto Veronezi Salvador >Priority: Minor > Original Estimate: 6h > Time Spent: 0.5h > Remaining Estimate: 5.5h > > *ReflectionToStringBuilder* has methods to exclude fields from *toString*; If > we have an object with several fields and want to reflect only a fews, we > have to list all the fields that we don't want to reflect and pass to > *excludeFieldNames*. > Would be valid implement a way to pass the fields that we want and reflect > only the selected fields? > > -- This message was sent by Atlassian Jira (v8.20.1#820001)
[jira] [Work logged] (LANG-1662) Create methods on ReflectionToStringBuilder to reflect only select fields
[ https://issues.apache.org/jira/browse/LANG-1662?focusedWorklogId=713048=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-713048 ] ASF GitHub Bot logged work on LANG-1662: Author: ASF GitHub Bot Created on: 21/Jan/22 19:37 Start Date: 21/Jan/22 19:37 Worklog Time Spent: 10m Work Description: rafaelweingartner commented on a change in pull request #849: URL: https://github.com/apache/commons-lang/pull/849#discussion_r789944501 ## File path: src/main/java/org/apache/commons/lang3/builder/ReflectionToStringBuilder.java ## @@ -385,6 +385,19 @@ public static String toStringExclude(final Object object, final Collection Create methods on ReflectionToStringBuilder to reflect only select fields > - > > Key: LANG-1662 > URL: https://issues.apache.org/jira/browse/LANG-1662 > Project: Commons Lang > Issue Type: Improvement > Components: lang.builder.* >Reporter: Daniel Augusto Veronezi Salvador >Priority: Minor > Original Estimate: 6h > Time Spent: 20m > Remaining Estimate: 5h 40m > > *ReflectionToStringBuilder* has methods to exclude fields from *toString*; If > we have an object with several fields and want to reflect only a fews, we > have to list all the fields that we don't want to reflect and pass to > *excludeFieldNames*. > Would be valid implement a way to pass the fields that we want and reflect > only the selected fields? > > -- This message was sent by Atlassian Jira (v8.20.1#820001)
[jira] [Work logged] (LANG-1662) Create methods on ReflectionToStringBuilder to reflect only select fields
[ https://issues.apache.org/jira/browse/LANG-1662?focusedWorklogId=713044=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-713044 ] ASF GitHub Bot logged work on LANG-1662: Author: ASF GitHub Bot Created on: 21/Jan/22 19:24 Start Date: 21/Jan/22 19:24 Worklog Time Spent: 10m Work Description: GutoVeronezi opened a new pull request #849: URL: https://github.com/apache/commons-lang/pull/849 As commented in JIRA issue [LANG-1662](https://issues.apache.org/jira/browse/LANG-1662) and the maillist ([here](https://lists.apache.org/thread/348sxhc277r45hkwt39rpdwxmxt5lrrs) and [here](https://lists.apache.org/thread/4nxrlfrzssv5w09c2gs9sphn7rgoc613)), the class **ReflectionToStringBuilder** has methods to exclude fields from *toString*; If we have an object with several fields and want to reflect only some, we have to list all the fields that we don't want to reflect and pass to **excludeFieldNames**. To examplify what I mean: - In a case which we need to print only the fields `a`, `b` and `e` from the class `UseCase`, the current solution is: ```java Example example = new UseCase.Example(); example.setA("test"); example.setB(1); example.setC(1.1); example.setD(true); example.setE(false); example.setF(false); example.setG(true); ToStringBuilder toStringBuilder = new ToStringBuilder(example, ToStringStyle.JSON_STYLE); toStringBuilder.append("a", example.getA()); toStringBuilder.append("b", example.getB()); toStringBuilder.append("e", example.isE()); System.out.println(toStringBuilder.build()); ``` -- 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. To unsubscribe, e-mail: issues-unsubscr...@commons.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking --- Worklog Id: (was: 713044) Remaining Estimate: 5h 50m (was: 6h) Time Spent: 10m > Create methods on ReflectionToStringBuilder to reflect only select fields > - > > Key: LANG-1662 > URL: https://issues.apache.org/jira/browse/LANG-1662 > Project: Commons Lang > Issue Type: Improvement > Components: lang.builder.* >Reporter: Daniel Augusto Veronezi Salvador >Priority: Minor > Original Estimate: 6h > Time Spent: 10m > Remaining Estimate: 5h 50m > > *ReflectionToStringBuilder* has methods to exclude fields from *toString*; If > we have an object with several fields and want to reflect only a fews, we > have to list all the fields that we don't want to reflect and pass to > *excludeFieldNames*. > Would be valid implement a way to pass the fields that we want and reflect > only the selected fields? > > -- This message was sent by Atlassian Jira (v8.20.1#820001)