Package org.identityconnectors.common
Class EqualsHashCodeBuilder
java.lang.Object
org.identityconnectors.common.EqualsHashCodeBuilder
Builder to simplify implementing the
Object.equals(Object) and
Object.hashCode() methods. This class uses ArrayList's
implementation of ArrayList.equals(Object) and
ArrayList.hashCode() and takes special care with deep arrays and
Collection based objects.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAppends the field value to an ArrayList to help facilitate equality testing.voidappendBean(Object obj) This method will attempt to use reflection to get all the properties that make up the identity of the object.booleanDetermine equality based on the value of the members append to the builder.inthashCode()Determine the hashcode based on the various members.toString()Show the contents that make up the key.
-
Constructor Details
-
EqualsHashCodeBuilder
public EqualsHashCodeBuilder()Construct the builder.
-
-
Method Details
-
append
Appends the field value to an ArrayList to help facilitate equality testing.- Parameters:
object-- Returns:
- Throws:
IllegalArgumentException- if 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
This method will attempt to use reflection to get all the properties that make up the identity of the object. It willappend(Object)all results from get methods that have a corresponding set method. -
equals
Determine equality based on the value of the members append to the builder. -
hashCode
public int hashCode()Determine the hashcode based on the various members. -
toString
Show the contents that make up the key.
-