[ https://issues.apache.org/jira/browse/LANG-1662?focusedWorklogId=737161&page=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)