Top Description Fields Constructors Methods
tools.jackson.databind.exc

public Class MismatchedInputException

extends DatabindException
Class Inheritance
Known Direct Subclasses
tools.jackson.databind.exc.PropertyBindingException, tools.jackson.databind.exc.InvalidFormatException, tools.jackson.databind.exc.InvalidNullException, tools.jackson.databind.exc.InvalidTypeIdException
Imports
tools.jackson.core.*, tools.jackson.databind.DatabindException, .JavaType, tools.jackson.databind.util.ClassUtil

General exception type used as the base class for all DatabindExceptions 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.

Field Summary

Modifier and TypeField and Description
protected JsonToken
_currentToken

Current token at the point when exception was thrown (if available).

protected Class<?>
_targetType

Type of value that was to be deserialized

private static final long

Constructor Summary

AccessConstructor and Description
protected
protected
protected
protected

Method Summary

Modifier and TypeMethod and Description
protected static JsonToken
public static MismatchedInputException
from(JsonParser p, JavaType targetType, String msg)

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

public JsonToken

Returns:

Current token at the point when exception was thrown, if available (null if not)
getCurrentToken
()

public Class<?>
getTargetType()

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

public MismatchedInputException
public MismatchedInputException
Inherited from tools.jackson.databind.DatabindException:
fromfromfromfromfromfromfromfromwrapWithPathwrapWithPath

Field Detail

_currentTokenback to summary
protected JsonToken _currentToken

Current token at the point when exception was thrown (if available).

_targetTypeback to summary
protected Class<?> _targetType

Type of value that was to be deserialized

serialVersionUIDback to summary
private static final long serialVersionUID

Hides tools.jackson.databind.DatabindException.serialVersionUID.

Constructor Detail

MismatchedInputExceptionback to summary
protected MismatchedInputException(JsonParser p, String msg)
MismatchedInputExceptionback to summary
protected MismatchedInputException(JsonParser p, String msg, TokenStreamLocation loc)
MismatchedInputExceptionback to summary
protected MismatchedInputException(JsonParser p, String msg, Class<?> targetType)
MismatchedInputExceptionback to summary
protected MismatchedInputException(JsonParser p, String msg, JavaType targetType)

Method Detail

_currentTokenback to summary
protected static JsonToken _currentToken(JsonParser p)
fromback to summary
public static MismatchedInputException from(JsonParser p, JavaType targetType, String msg)
fromback to summary
public static MismatchedInputException from(JsonParser p, Class<?> targetType, String msg)
getCurrentTokenback to summary
public JsonToken getCurrentToken()
Returns:JsonToken

Current token at the point when exception was thrown, if available (null if not)

getTargetTypeback to summary
public Class<?> getTargetType()

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

setCurrentTokenback to summary
public MismatchedInputException setCurrentToken(JsonToken t)
setTargetTypeback to summary
public MismatchedInputException setTargetType(JavaType t)