On this page

Diff

public abstract class org.apache.commons.lang3.builder.Diff<T> extends Pair<T, T>[source]

A Diff contains the differences between two Diffable class fields.

Typically, Diffs are retrieved by using a DiffBuilder to produce a DiffResult, containing the differences between two objects.

Parameters:

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

Since:

3.3

Constructors

Diff(String)

Constructs a new Diff for the given field name.

protected Diff(String fieldName)[source]

Constructs a new Diff for the given field name.

Parameters:

fieldName – the field name.

Methods

getFieldName()

Gets the name of the field.

getType()

Deprecated. Gets the type of the field.

setValue(Object)

Sets no value and always throws UnsupportedOperationException.

toString()

Returns a String representation of the Diff, with the following format:

public final String getFieldName()[source]

Gets the name of the field.

Returns:

The field name.

@Deprecated public final Type getType()[source]

Deprecated: Unused, will be removed in 4.0.0.

Gets the type of the field.

Returns:

The field type.

@Override public final T setValue(T value)[source]

Sets no value and always throws UnsupportedOperationException.

Parameters:

value – ignored.

Returns:

Throws UnsupportedOperationException.

@Override public final String toString()[source]

Returns a String representation of the Diff, with the following format:

[fieldname: left-value, right-value]
Returns:

The string representation.