Skip navigation links


org.identityconnectors.common
Class EqualsHashCodeBuilder

java.lang.Object
  extended by org.identityconnectors.common.EqualsHashCodeBuilder


public final class EqualsHashCodeBuilder
extends java.lang.Object

Builder to simplify implementing the Object.equals(Object) and Object.hashCode() methods. This class uses ArrayList's implementation of AbstractList.equals(Object) and AbstractList.hashCode() and takes special care with deep arrays and Collection based objects.


Constructor Summary
EqualsHashCodeBuilder()
          Construct the builder.

 

Method Summary
 EqualsHashCodeBuilder append(java.lang.Object object)
          Appends the field value to an ArrayList to help facilitate equality testing.
 void appendBean(java.lang.Object obj)
          This method will attempt to use reflection to get all the properties that make up the identity of the object.
 boolean equals(java.lang.Object obj)
          Determine equality based on the value of the members append to the builder.
 int hashCode()
          Determine the hashcode based on the various members.
 java.lang.String toString()
          Show the contents that make up the key.

 

Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait

 

Constructor Detail

EqualsHashCodeBuilder

public EqualsHashCodeBuilder()
Construct the builder.

Method Detail

append

public EqualsHashCodeBuilder append(java.lang.Object object)
Appends the field value to an ArrayList to help facilitate equality testing.
Throws:
java.lang.IllegalArgumentException - iff a collection is passed since collections do not support value based equality. Sets, Lists, and Maps will work since they support value based equality.

appendBean

public void appendBean(java.lang.Object obj)
This method will attempt to use reflection to get all the properties that make up the identity of the object. It will append(Object) all results from get methods that have a corresponding set method.

equals

public boolean equals(java.lang.Object obj)
Determine equality based on the value of the members append to the builder.
Overrides:
equals in class java.lang.Object
See Also:
Object.equals(java.lang.Object)

hashCode

public int hashCode()
Determine the hashcode based on the various members.
Overrides:
hashCode in class java.lang.Object
See Also:
Object.hashCode()

toString

public java.lang.String toString()
Show the contents that make up the key.
Overrides:
toString in class java.lang.Object
See Also:
Object.toString()

Skip navigation links


Copyright © 2011, Oracle and/or its affiliates. All rights reserved.