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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]