You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by sc...@apache.org on 2002/12/08 22:10:42 UTC

cvs commit: jakarta-commons/lang/src/java/org/apache/commons/lang/builder EqualsBuilder.java

scolebourne    2002/12/08 13:10:42

  Modified:    lang/src/java/org/apache/commons/lang/builder
                        EqualsBuilder.java
  Log:
  Add ability to build compound equals using superclass
  
  Revision  Changes    Path
  1.7       +18 -1     jakarta-commons/lang/src/java/org/apache/commons/lang/builder/EqualsBuilder.java
  
  Index: EqualsBuilder.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/lang/src/java/org/apache/commons/lang/builder/EqualsBuilder.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- EqualsBuilder.java	17 Nov 2002 21:46:42 -0000	1.6
  +++ EqualsBuilder.java	8 Dec 2002 21:10:42 -0000	1.7
  @@ -82,6 +82,7 @@
    *   }
    *  MyClass rhs = (MyClass) o;
    *  return new EqualsBuilder()
  + *                 .appendSuper(super.equals(o))
    *                 .append(field1, rhs.field1)
    *                 .append(field2, rhs.field2)
    *                 .append(field3, rhs.field3)
  @@ -198,6 +199,22 @@
           return equalsBuilder.isEquals();
       }
   
  +    //-------------------------------------------------------------------------
  +    
  +    /**
  +     * <p>Adds the result of super.equals() to this builder.</p>
  +     *
  +     * @param superEquals  the result of calling <code>super.equals()</code>
  +     * @return EqualsBuilder - used to chain calls.
  +     */
  +    public EqualsBuilder appendSuper(boolean superEquals) {
  +        if (isEquals == false) {
  +            return this;
  +        }
  +        isEquals = superEquals;
  +        return this;
  +    }
  +    
       //-------------------------------------------------------------------------
       
       /**
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>