commons-issues mailing list archives

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

     [ https://issues.apache.org/jira/browse/LANG-1330?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Jason Smiley updated LANG-1330:
-------------------------------
    Description: 
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.

  was:
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();
//has custom equalsWithoutID() method via inheritance;
}

class SpecialChild extend Child {
public String id;
public String name;
//uses ReflectionEqualsBuilder for equals();
//has custom equalsWithoutID() method via inheritence;
}
{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.


> 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