Top Description Interfaces Annotations Classes
[default module]

Package org.apache.commons.lang3.builder


Provides classes to create 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 org.apache.commons.lang3.builder.HashCodeBuilder will save your day. It, and its buddies (org.apache.commons.lang3.builder.EqualsBuilder, org.apache.commons.lang3.builder.CompareToBuilder, org.apache.commons.lang3.builder.ToStringBuilder), take care of the nasty bits while you focus on the important bits, like which fields will go into making up the hash code.

Since
1.0
See Also
Object#equals(Object), Object#toString(), Object#hashCode(), Comparable#compareTo(Object)

Interface Summary

Modifier and TypeInterface and Description
public interface
Builder<
the type of object that the builder will construct or compute.
T
>

The Builder interface is designed to designate a class as a builder object in the Builder design pattern.

public interface
Diffable<
the type of objects that this object may be differentiated against
T
>

Diffable classes can be compared with other objects for differences.

Annotation Summary

Modifier and TypeAnnotation and Description
public @interface
DiffExclude

Excludes a field from being used by the ReflectionDiffBuilder.

public @interface
EqualsExclude

Excludes a field from being used by the various reflectionEquals methods defined on EqualsBuilder.

public @interface
HashCodeExclude

Exclude a field from being used by the various reflectionHashcode methods defined on HashCodeBuilder.

public @interface
ToStringExclude

Excludes a field from being used by the ReflectionToStringBuilder.

public @interface
ToStringSummary

Use this annotation on the fields to get the summary instead of the detailed information when using ReflectionToStringBuilder.

Class Summary

Modifier and TypeClass and Description
public abstract class
AbstractSupplier<
The type of results supplied by this supplier.
T
,
the type of builder.
B extends AbstractSupplier<T, B, E>
,
The kind of thrown exception or error.
E extends Throwable
>

Abstracts supplying an instance of T.

public class
CompareToBuilder

Assists in implementing Comparable#compareTo(Object) methods.

public abstract class
Diff<
The type of object contained within this Diff. Differences between primitive objects are stored as their Object wrapper equivalent.
T
>

A Diff contains the differences between two Diffable class fields.

public class
DiffBuilder<
type of the left and right object.
T
>

Assists in implementing Diffable#diff(Object) methods.

public class
DiffResult<
type of the left and right object.
T
>

A DiffResult contains a collection of the differences between two Diffable objects.

public class
EqualsBuilder

Assists in implementing Object#equals(Object) methods.

public class
HashCodeBuilder

Assists in implementing Object#hashCode() methods.

pack-priv class
IDKey

Wrap an identity key (System.identityHashCode()) so that an object can only be equal() to itself.

public class
MultilineRecursiveToStringStyle

Works with ToStringBuilder to create a "deep" toString.

public class
RecursiveToStringStyle

Works with ToStringBuilder to create a "deep" toString.

pack-priv class
Reflection

Package-private reflection code.

public class
ReflectionDiffBuilder<
type of the left and right object to diff.
T
>

Assists in implementing Diffable#diff(Object) methods.

public class
ReflectionToStringBuilder

Assists in implementing Object#toString() methods using reflection.

public class
StandardToStringStyle

Works with ToStringBuilder to create a toString.

public class
ToStringBuilder

Assists in implementing Object#toString() methods.

public abstract class
ToStringStyle

Controls String formatting for ToStringBuilder.