Package org.apache.commons.lang3.builder
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.
- Since:
- 1.0
- See Also:
Object.equals(Object),Object.toString(),Object.hashCode(),Comparable.compareTo(Object)
-
Interface Summary Interface Description Builder<T> The Builder interface is designed to designate a class as a builder object in the Builder design pattern.Diffable<T> Diffableclasses can be compared with other objects for differences. -
Class Summary Class Description CompareToBuilder Assists in implementingComparable.compareTo(Object)methods.Diff<T> ADiffcontains the differences between twoDiffableclass fields.DiffBuilder<T> Assists in implementingDiffable.diff(Object)methods.DiffResult<T> ADiffResultcontains a collection of the differences between twoDiffableobjects.EqualsBuilder Assists in implementingObject.equals(Object)methods.HashCodeBuilder Assists in implementingObject.hashCode()methods.MultilineRecursiveToStringStyle Works withToStringBuilderto create a "deep"toString.RecursiveToStringStyle Works withToStringBuilderto create a "deep"toString.ReflectionDiffBuilder<T> Assists in implementingDiffable.diff(Object)methods.ReflectionToStringBuilder Assists in implementingObject.toString()methods using reflection.StandardToStringStyle Works withToStringBuilderto create atoString.ToStringBuilder Assists in implementingObject.toString()methods.ToStringStyle ControlsStringformatting forToStringBuilder. -
Annotation Types Summary Annotation Type Description EqualsExclude Use this annotation to exclude a field from being used by the variousreflectionEqualsmethods defined onEqualsBuilder.HashCodeExclude Use this annotation to exclude a field from being used by the variousreflectionHashcodemethods defined onHashCodeBuilder.ToStringExclude Use this annotation to exclude a field from being used by theReflectionToStringBuilder.ToStringSummary Use this annotation on the fields to get the summary instead of the detailed information when usingReflectionToStringBuilder.