equals(Object)
, toString()
, hashCode()
, and compareTo(Object)
methods.See: Description
Interface | Description |
---|---|
Builder<T> |
The Builder interface is designed to designate a class as a builder
object in the Builder design pattern.
|
Diffable<T> |
Diffable classes can be compared with other objects
for differences. |
Class | Description |
---|---|
CompareToBuilder |
Assists in implementing
Comparable.compareTo(Object) methods. |
Diff<T> |
A
Diff contains the differences between two Diffable class
fields. |
DiffBuilder |
Assists in implementing
Diffable.diff(Object) methods. |
DiffResult |
A
DiffResult contains a collection of the differences between two
Diffable objects. |
EqualsBuilder |
Assists in implementing
Object.equals(Object) methods. |
HashCodeBuilder |
Assists in implementing
Object.hashCode() methods. |
IDKey |
Wrap an identity key (System.identityHashCode())
so that an object can only be equal() to itself.
|
MultilineRecursiveToStringStyle |
Works with
ToStringBuilder to create a "deep" toString . |
RecursiveToStringStyle |
Works with
ToStringBuilder to create a "deep" toString . |
ReflectionDiffBuilder |
Assists in implementing
Diffable.diff(Object) methods. |
ReflectionToStringBuilder |
Assists in implementing
Object.toString() methods using reflection. |
StandardToStringStyle |
Works with
ToStringBuilder to create a toString . |
ToStringBuilder |
Assists in implementing
Object.toString() methods. |
ToStringStyle |
Controls
String formatting for ToStringBuilder . |
ToStringStyle.DefaultToStringStyle |
Default
ToStringStyle . |
ToStringStyle.JsonToStringStyle |
ToStringStyle that outputs with JSON format. |
ToStringStyle.MultiLineToStringStyle |
ToStringStyle that outputs on multiple lines. |
ToStringStyle.NoClassNameToStringStyle |
ToStringStyle that does not print out the classname
and identity hash code but prints content start and field names. |
ToStringStyle.NoFieldNameToStringStyle |
ToStringStyle that does not print out
the field names. |
ToStringStyle.ShortPrefixToStringStyle |
ToStringStyle that prints out the short
class name and no identity hashcode. |
ToStringStyle.SimpleToStringStyle |
ToStringStyle that does not print out the
classname, identity hashcode, content start or field name. |
Annotation Type | Description |
---|---|
EqualsExclude |
Use this annotation to exclude a field from being used by
the various
reflectionEquals methods defined on
EqualsBuilder . |
HashCodeExclude |
Use this annotation to exclude a field from being used by
the various
reflectionHashcode methods defined on
HashCodeBuilder . |
ToStringExclude |
Use this annotation to exclude a field from being used by
the
ReflectionToStringBuilder . |
Assists in creating consistent equals(Object)
, toString()
, hashCode()
, and compareTo(Object)
methods.
These classes are not thread-safe.
When you write a hashCode()
, do you check Bloch's Effective Java? No?
You just hack in a quick number?
Well HashCodeBuilder
will save your day.
It, and its buddies (EqualsBuilder
, CompareToBuilder
, ToStringBuilder
), take care of the nasty bits while you focus on the important bits, like which fields will go into making up the hashcode.
Object.equals(Object)
,
Object.toString()
,
Object.hashCode()
,
Comparable.compareTo(Object)