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