com.fasterxml.jackson.databind

## Class JsonMappingException.Reference

- java.lang.Object
- - com.fasterxml.jackson.databind.JsonMappingException.Reference

- All Implemented Interfaces:
    java.io.Serializable
  Enclosing class:
    JsonMappingException

      public static class JsonMappingException.Reference
      extends java.lang.Object
      implements java.io.Serializable

  Simple bean class used to contain references. References can be added to indicate execution/reference path that lead to the problem that caused this exception to be thrown.
  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected java.lang.String` | `_desc` Lazily-constructed description of this instance; needed mostly to allow JDK serialization to work in case where `_from` is non-serializable (and has to be dropped) but we still want to pass actual description along.
    `protected java.lang.String` | `_fieldName` Name of field (for beans) or key (for Maps) that is part of the reference.
    `protected java.lang.Object` | `_from`
    `protected int` | `_index` Index within a `Collection` instance that contained the reference; used if index is relevant and available.

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `JsonMappingException.Reference()` Default constructor for deserialization/sub-classing purposes
    `` | `JsonMappingException.Reference(java.lang.Object from)`
    `` | `JsonMappingException.Reference(java.lang.Object from, int index)`
    `` | `JsonMappingException.Reference(java.lang.Object from, java.lang.String fieldName)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.String` | `getDescription()`
    `java.lang.String` | `getFieldName()`
    `java.lang.Object` | `getFrom()` Object through which reference was resolved.
    `int` | `getIndex()`
    `java.lang.String` | `toString()`

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

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

- - ### Field Detail

    - #### _from

          protected transient java.lang.Object _from

    - #### _fieldName

          protected java.lang.String _fieldName

      Name of field (for beans) or key (for Maps) that is part of the reference. May be null for Collection types (which generally have `_index` defined), or when resolving Map classes without (yet) having an instance to operate on.

    - #### _index

          protected int _index

      Index within a `Collection` instance that contained the reference; used if index is relevant and available. If either not applicable, or not available, -1 is used to denote "not known" (or not relevant).

    - #### _desc

          protected java.lang.String _desc

      Lazily-constructed description of this instance; needed mostly to allow JDK serialization to work in case where `_from` is non-serializable (and has to be dropped) but we still want to pass actual description along.
      Since:
        2.8

  - ### Constructor Detail

    - #### JsonMappingException.Reference

          protected JsonMappingException.Reference()

      Default constructor for deserialization/sub-classing purposes

    - #### JsonMappingException.Reference

          public JsonMappingException.Reference(java.lang.Object from)

    - #### JsonMappingException.Reference

          public JsonMappingException.Reference(java.lang.Object from,
                                        java.lang.String fieldName)

    - #### JsonMappingException.Reference

          public JsonMappingException.Reference(java.lang.Object from,
                                        int index)

  - ### Method Detail

    - #### getFrom

          public java.lang.Object getFrom()

      Object through which reference was resolved. Can be either actual instance (usually the case for serialization), or Class (usually the case for deserialization).

      Note that this value must be `transient` to allow serializability (as often such Object is NOT serializable; or, in case of `Class`, may not available at the point of deserialization). As such will return `null` if instance has been passed using JDK serialization.

    - #### getFieldName

          public java.lang.String getFieldName()

    - #### getIndex

          public int getIndex()

    - #### getDescription

          public java.lang.String getDescription()

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`