org.apache.commons.lang3.builder

## Class Diff<T>

- java.lang.Object
- - org.apache.commons.lang3.tuple.Pair<T,T>
  - - org.apache.commons.lang3.builder.Diff<T>

- Type Parameters:
    `T` - The type of object contained within this `Diff`. Differences between primitive objects are stored as their Object wrapper equivalent.
  All Implemented Interfaces:
    Serializable, Comparable<Pair<T,T>>, Map.Entry<T,T>

      public abstract class Diff<T>
      extends Pair<T,T>

  A `Diff` contains the differences between two `Diffable` class fields.

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

  Since:
    3.3
  Version:
    $Id: Diff.java 1606051 2014-06-27 12:22:17Z ggregory $
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `Diff(String fieldName)` Constructs a new `Diff` for the given field name.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `String` | `getFieldName()` Returns the name of the field.
    `Type` | `getType()` Returns the type of the field.
    `T` | `setValue(T value)` Throws `UnsupportedOperationException`.
    `String` | `toString()` Returns a `String` representation of the `Diff`, with the following format: [fieldname: left-value, right-value]

    - ### Methods inherited from class org.apache.commons.lang3.tuple.Pair

      `compareTo, equals, getKey, getLeft, getRight, getValue, hashCode, of, toString`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### Diff

          protected Diff(String fieldName)

      Constructs a new `Diff` for the given field name.

      Parameters:
        `fieldName` - the name of the field

  - ### Method Detail

    - #### getType

          public final Type getType()

      Returns the type of the field.

      Returns:
        the field type

    - #### getFieldName

          public final String getFieldName()

      Returns the name of the field.

      Returns:
        the field name

    - #### toString

          public final String toString()

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

           [fieldname: left-value, right-value]

      Overrides:
        `toString` in class `Pair<T,T>`
      Returns:
        the string representation

    - #### setValue

          public final T setValue(T value)

      Throws `UnsupportedOperationException`.

      Parameters:
        `value` - ignored
      Returns:
        nothing

Copyright © 2001–2015 The Apache Software Foundation. All rights reserved.