commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Charles Honton (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (LANG-1330) EqualsBuilder should be able to call custom equals method for specified class
Date Wed, 10 May 2017 15:23:04 GMT

    [ https://issues.apache.org/jira/browse/LANG-1330?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16004847#comment-16004847
] 

Charles Honton commented on LANG-1330:
--------------------------------------

IF implemented, care must be taken to prevent this from being a ["gadget chain"|https://blogs.apache.org/foundation/entry/apache_commons_statement_to_widespread]
for malware.

> EqualsBuilder should be able to call custom equals method for specified class
> -----------------------------------------------------------------------------
>
>                 Key: LANG-1330
>                 URL: https://issues.apache.org/jira/browse/LANG-1330
>             Project: Commons Lang
>          Issue Type: New Feature
>            Reporter: Jason Smiley
>
> As a tester, there are times I want to exclude certain fields (like ID) for my parent
object and its children.
> For example:
> {code}
> class Parent {
> public String id;
> public NormalChild child1;
> public SpecialChild child2;
> //uses ReflectionEqualsBuilder for equals();
> //has custom equalsWithoutID() method;
> }
> class NormalChild extend Child {
> public String name;
> //uses ReflectionEqualsBuilder equals() via inheritence;
> //has custom equalsWithoutID() method;
> }
> class SpecialChild extend Child {
> public String id;
> public String name;
> //uses ReflectionEqualsBuilder for equals() via inheritence
> //has custom equalsWithoutID() method;
> }
> abstract class Child{
> //implementes  equals();
> public abstract boolean equalsWithoutID();
> }
> {code}
> If I am running a reflectionEquals with excluding field "id" on my parent object, the
excludedFields won't be used on my children classes (only excludes fields of parent with name).
I would like to be able to call the custom equalsWithoutID() if its an instance of class Child.
> Currently i need to do a workaround where my equals() checks to see which method I was
using before executing but its not an ideal solution.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Mime
View raw message