com.fasterxml.jackson.databind.exc

## Class MismatchedInputException

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

All Implemented Interfaces:
  Serializable

Direct Known Subclasses:
  InvalidFormatException, InvalidNullException, InvalidTypeIdException, PropertyBindingException

    public class MismatchedInputException
    extends JsonMappingException

General exception type used as the base class for all `JsonMappingException`s that are due to input not mapping to target definition; these are typically considered "client errors" since target type definition itself is not the root cause but mismatching input. This is in contrast to `InvalidDefinitionException` which signals a problem with target type definition and not input.

This type is used as-is for some input problems, but in most cases there should be more explicit subtypes to use.

NOTE: name chosen to differ from `java.util.InputMismatchException` since while that would have been better name, use of same overlapping name causes nasty issues with IDE auto-completion, so slightly less optimal chosen.

Since:
  2.9
See Also:
  Serialized Form

### Nested Class Summary

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

`JsonMappingException.Reference`

### Field Summary

Fields
`protected Class<?>` `_targetType` Type of value that was to be deserialized

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

`_path, _processor`

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

`_location`

### Constructor Summary

Constructors
`protected` `MismatchedInputException(JsonParser p, String msg)`
`protected` `MismatchedInputException(JsonParser p, String msg, Class<?> targetType)`
`protected` `MismatchedInputException(JsonParser p, String msg, JavaType targetType)`
`protected` `MismatchedInputException(JsonParser p, String msg, JsonLocation loc)`

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods
`static MismatchedInputException` `from(JsonParser p, Class<?> targetType, String msg)`
`static MismatchedInputException` `from(JsonParser p, JavaType targetType, String msg)`
`static MismatchedInputException` `from(JsonParser p, String msg)` Deprecated.
`Class<?>` `getTargetType()` Accessor for getting intended target type, with which input did not match, if known; `null` if not known for some reason.
`MismatchedInputException` `setTargetType(JavaType t)`

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

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

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

`clearLocation, 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

#### _targetType

    protected Class<?> _targetType

Type of value that was to be deserialized

### Constructor Detail

#### MismatchedInputException

    protected MismatchedInputException(JsonParser p,
                                       String msg)

#### MismatchedInputException

    protected MismatchedInputException(JsonParser p,
                                       String msg,
                                       JsonLocation loc)

#### MismatchedInputException

    protected MismatchedInputException(JsonParser p,
                                       String msg,
                                       Class<?> targetType)

#### MismatchedInputException

    protected MismatchedInputException(JsonParser p,
                                       String msg,
                                       JavaType targetType)

### Method Detail

#### from

    @Deprecated
    public static MismatchedInputException from(JsonParser p,
                                                            String msg)

Deprecated.

#### from

    public static MismatchedInputException from(JsonParser p,
                                                JavaType targetType,
                                                String msg)

#### from

    public static MismatchedInputException from(JsonParser p,
                                                Class<?> targetType,
                                                String msg)

#### setTargetType

    public MismatchedInputException setTargetType(JavaType t)

#### getTargetType

    public Class<?> getTargetType()

Accessor for getting intended target type, with which input did not match, if known; `null` if not known for some reason.