[
https://issues.apache.org/jira/browse/LANG-1677?focusedWorklogId=753592&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-753592
]
ASF GitHub Bot logged work on LANG-1677:
----------------------------------------
Author: ASF GitHub Bot
Created on: 06/Apr/22 18:42
Start Date: 06/Apr/22 18:42
Worklog Time Spent: 10m
Work Description: debae commented on code in PR #838:
URL: https://github.com/apache/commons-lang/pull/838#discussion_r844273828
##########
src/main/java/org/apache/commons/lang3/builder/ReflectionDiffBuilder.java:
##########
@@ -131,7 +167,15 @@ private boolean accept(final Field field) {
if (Modifier.isTransient(field.getModifiers())) {
return false;
}
- return !Modifier.isStatic(field.getModifiers());
+ if (Modifier.isStatic(field.getModifiers())) {
+ return false;
+ }
+ if (this.excludeFieldNames != null
Review Comment:
I took some "inspiration" from the `ReflectionToStringBuilder` where we also
have the null check.
In case you do call setExcludeFieldNames with null, it's still safe here,
guess that's the main reason.
Issue Time Tracking
-------------------
Worklog Id: (was: 753592)
Time Spent: 2h 20m (was: 2h 10m)
> It should be possible to exclude fields in ReflectionDiffBuilder
> ----------------------------------------------------------------
>
> Key: LANG-1677
> URL: https://issues.apache.org/jira/browse/LANG-1677
> Project: Commons Lang
> Issue Type: Wish
> Components: lang.builder.*
> Affects Versions: 3.12.0
> Reporter: Dennis Baerten
> Priority: Major
> Time Spent: 2h 20m
> Remaining Estimate: 0h
>
> When using ReflectionDiffBuilder to make a diff between two object it will be
> default include all fields. As stated in the documentation static and
> transient fields are excluded.
> Using the transient modifier in combination with other frameworks ( such as
> Hibernate ) also has a side affect that those fields are not persisted.
> The use case I'm trying to solve it making a diff of an object that get's
> updated and has a LastModificationDate and LastModificationUser and thus will
> always be a field in the diff.
--
This message was sent by Atlassian Jira
(v8.20.1#820001)