Jason Smiley created LANG-1330:
----------------------------------

             Summary: EqualsBuilder can call custom equals method for 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:

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;
}

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)

Reply via email to