InvalidFormatException
Date: 2016-12-04

com.fasterxml.jackson.databind.exc

## Class InvalidFormatException

- java.lang.Object
- - java.lang.Throwable
  - - java.lang.Exception
    - - java.io.IOException
      - - com.fasterxml.jackson.core.JsonProcessingException
        - - com.fasterxml.jackson.databind.JsonMappingException
          - - com.fasterxml.jackson.databind.exc.InvalidFormatException

- All Implemented Interfaces:
    java.io.Serializable

      public class InvalidFormatException
      extends JsonMappingException

  Specialized sub-class of `JsonMappingException` that is used when the underlying problem appears to be that of bad formatting of a value to deserialize.
  Since:
    2.1
  See Also:
    Serialized Form

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class com.fasterxml.jackson.databind.JsonMappingException

      `JsonMappingException.Reference`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected java.lang.Class<?>` | `_targetType` Intended target type (type-erased class) that value could not be deserialized into, if known.
    `protected java.lang.Object` | `_value` Underlying value that could not be deserialized into target type, if available.

    - ### Fields inherited from class com.fasterxml.jackson.databind.JsonMappingException

      `_path, _processor`

    - ### Fields inherited from class com.fasterxml.jackson.core.JsonProcessingException

      `_location`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `InvalidFormatException(com.fasterxml.jackson.core.JsonParser p, java.lang.String msg, java.lang.Object value, java.lang.Class<?> targetType)`
    `InvalidFormatException(java.lang.String msg, com.fasterxml.jackson.core.JsonLocation loc, java.lang.Object value, java.lang.Class<?> targetType)` Deprecated. Since 2.7 Use variant that takes `JsonParser`
    `InvalidFormatException(java.lang.String msg, java.lang.Object value, java.lang.Class<?> targetType)` Deprecated. Since 2.7 Use variant that takes `JsonParser`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static InvalidFormatException` | `from(com.fasterxml.jackson.core.JsonParser p, java.lang.String msg, java.lang.Object value, java.lang.Class<?> targetType)`
    `java.lang.Class<?>` | `getTargetType()` Accessor for checking target type of value (`getValue()` that failed to deserialize.
    `java.lang.Object` | `getValue()` Accessor for checking source value (String, Number usually) that could not be deserialized into target type (`getTargetType()`).

    - ### Methods inherited from class com.fasterxml.jackson.databind.JsonMappingException

      `_appendPathDesc, _buildMessage, from, from, from, from, from, from, from, from, fromUnexpectedIOE, getLocalizedMessage, getMessage, getPath, getPathReference, getPathReference, getProcessor, prependPath, prependPath, prependPath, toString, wrapWithPath, wrapWithPath, wrapWithPath`

    - ### Methods inherited from class com.fasterxml.jackson.core.JsonProcessingException

      `getLocation, getMessageSuffix, getOriginalMessage`

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

      `addSuppressed, fillInStackTrace, getCause, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace`

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

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

- - ### Field Detail

    - #### _value

          protected final java.lang.Object _value

      Underlying value that could not be deserialized into target type, if available.

    - #### _targetType

          protected final java.lang.Class<?> _targetType

      Intended target type (type-erased class) that value could not be deserialized into, if known.

  - ### Constructor Detail

    - #### InvalidFormatException

          @Deprecated
          public InvalidFormatException(java.lang.String msg,
                                           java.lang.Object value,
                                           java.lang.Class<?> targetType)

      Deprecated. Since 2.7 Use variant that takes `JsonParser`

    - #### InvalidFormatException

          @Deprecated
          public InvalidFormatException(java.lang.String msg,
                                           com.fasterxml.jackson.core.JsonLocation loc,
                                           java.lang.Object value,
                                           java.lang.Class<?> targetType)

      Deprecated. Since 2.7 Use variant that takes `JsonParser`

    - #### InvalidFormatException

          public InvalidFormatException(com.fasterxml.jackson.core.JsonParser p,
                                java.lang.String msg,
                                java.lang.Object value,
                                java.lang.Class<?> targetType)

      Since:
        2.7

  - ### Method Detail

    - #### from

          public static InvalidFormatException from(com.fasterxml.jackson.core.JsonParser p,
                                    java.lang.String msg,
                                    java.lang.Object value,
                                    java.lang.Class<?> targetType)

    - #### getValue

          public java.lang.Object getValue()

      Accessor for checking source value (String, Number usually) that could not be deserialized into target type (`getTargetType()`). Note that value may not be available, depending on who throws the exception and when.

    - #### getTargetType

          public java.lang.Class<?> getTargetType()

      Accessor for checking target type of value (`getValue()` that failed to deserialize. Note that type may not be available, depending on who throws the exception and when.