Gilles Sadowski created LANG-1709:
-------------------------------------

             Summary: Check for "deep" copy
                 Key: LANG-1709
                 URL: https://issues.apache.org/jira/browse/LANG-1709
             Project: Commons Lang
          Issue Type: Wish
          Components: lang.builder.*
            Reporter: Gilles Sadowski


Wouldn't it be useful to have a way to easily check whether some object is a 
deep copy of another? I.e. the two instances could be "equal" but the utility 
function would return "false" if they share a mutable field.

More generally, how about a function like
{code:java}
public SomeUtils {
    /**
     * @return true if "a" and "b" do not share any mutable field.
     */
    public static <T> boolean areIndependent(T a, T b) { /* ... */ }

    // ...
}
{code}
?

It seems that this could (?) be built upon 
[{{ReflectionDiffBuilder}}|https://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/builder/ReflectionDiffBuilder.html].



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to