public final class EqualsHashCodeBuilder extends Object
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 and Description |
---|
EqualsHashCodeBuilder()
Construct the builder.
|
Modifier and Type | Method and Description |
---|---|
EqualsHashCodeBuilder |
append(Object object)
Appends the field value to an ArrayList to help facilitate equality
testing.
|
void |
appendBean(Object obj)
This method will attempt to use reflection to get all the properties that
make up the identity of the object.
|
boolean |
equals(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.
|
String |
toString()
Show the contents that make up the key.
|
public EqualsHashCodeBuilder append(Object object)
object
- 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.public void appendBean(Object obj)
append(Object)
all
results from get methods that have a corresponding
set method.public boolean equals(Object obj)
equals
in class Object
obj
- the reference object with which to compare.true
if this object is the same as the obj argument;
false
otherwise.Object.equals(java.lang.Object)
public int hashCode()
hashCode
in class Object
Object.hashCode()
public String toString()
toString
in class Object
Object.toString()
Copyright © 2019. All rights reserved.