Top Description Fields Constructors Methods
org.apache.commons.lang3.builder

public abstract Class Diff<T>

extends Pair<T, T>
Class Inheritance
Known Direct Subclasses
org.apache.commons.lang3.builder.DiffBuilder.SDiff
Type Parameters
<T>
The type of object contained within this Diff. Differences between primitive objects are stored as their Object wrapper equivalent.
Imports
java.lang.reflect.Type, java.util.Objects, org.apache.commons.lang3.ObjectUtils, org.apache.commons.lang3.reflect.TypeUtils, org.apache.commons.lang3.tuple.Pair

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.

Since
3.3

Field Summary

Modifier and TypeField and Description
private final String
fieldName

The field name.

private static final long
private final Type
type

The field type.

Inherited from org.apache.commons.lang3.tuple.Pair:
EMPTY_ARRAY

Constructor Summary

AccessConstructor and Description
protected
Diff(final String
the field name.
fieldName
)

Constructs a new Diff for the given field name.

pack-priv
Diff(final String fieldName, final Type type)

Method Summary

Modifier and TypeMethod and Description
public final String

Returns:

the field name.
getFieldName
()

Gets the name of the field.

public final Type

Returns:

the field type.
getType
()
Deprecated Unused, will be removed in 4.0.0.

Gets the type of the field.

public final T
public final String

Returns:

the string representation.
toString
()

Overrides org.apache.commons.lang3.tuple.Pair.toString.

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

[fieldname: left-value, right-value]
Inherited from org.apache.commons.lang3.tuple.Pair:
acceptapplycompareToemptyArrayequalsgetKeygetLeftgetRightgetValuehashCodeofofofNonNulltoString

Field Detail

fieldNameback to summary
private final String fieldName

The field name.

serialVersionUIDback to summary
private static final long serialVersionUID

Hides org.apache.commons.lang3.tuple.Pair.serialVersionUID.

typeback to summary
private final Type type

The field type.

Constructor Detail

Diffback to summary
protected Diff(final String fieldName)

Constructs a new Diff for the given field name.

Parameters
fieldName:String

the field name.

Diffback to summary
pack-priv Diff(final String fieldName, final Type type)

Method Detail

getFieldNameback to summary
public final String getFieldName()

Gets the name of the field.

Returns:String

the field name.

getTypeback to summary
public final Type getType()

Deprecated

Unused, will be removed in 4.0.0.

Gets the type of the field.

Returns:Type

the field type.

Annotations
@Deprecated
setValueback to summary
public final T setValue(final T value)

Implements java.util.Map.Entry.setValue.

Throws UnsupportedOperationException.

Parameters
value:T

ignored.

Returns:T

Throws UnsupportedOperationException.

Annotations
@Override
toStringback to summary
public final String toString()

Overrides org.apache.commons.lang3.tuple.Pair.toString.

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

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

the string representation.

Annotations
@Override