Class MismatchedInputException

java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
tools.jackson.core.JacksonException
tools.jackson.databind.DatabindException
tools.jackson.databind.exc.MismatchedInputException
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
DateTimeParseException, InvalidFormatException, InvalidNullException, InvalidTypeIdException, PropertyBindingException

public class MismatchedInputException extends DatabindException
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.

See Also:
  • Field Details

    • _targetType

      protected Class<?> _targetType
      Type of value that was to be deserialized
    • _currentToken

      protected tools.jackson.core.JsonToken _currentToken
      Current token at the point when exception was thrown (if available).
  • Constructor Details

    • MismatchedInputException

      protected MismatchedInputException(tools.jackson.core.JsonParser p, String msg)
    • MismatchedInputException

      protected MismatchedInputException(tools.jackson.core.JsonParser p, String msg, tools.jackson.core.TokenStreamLocation loc)
    • MismatchedInputException

      protected MismatchedInputException(tools.jackson.core.JsonParser p, String msg, Class<?> targetType)
    • MismatchedInputException

      protected MismatchedInputException(tools.jackson.core.JsonParser p, String msg, JavaType targetType)
  • Method Details

    • _currentToken

      protected static tools.jackson.core.JsonToken _currentToken(tools.jackson.core.JsonParser p)
    • from

      public static MismatchedInputException from(tools.jackson.core.JsonParser p, JavaType targetType, String msg)
    • from

      public static MismatchedInputException from(tools.jackson.core.JsonParser p, Class<?> targetType, String msg)
    • setTargetType

      public MismatchedInputException setTargetType(JavaType t)
    • setCurrentToken

      public MismatchedInputException setCurrentToken(tools.jackson.core.JsonToken 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.
    • getCurrentToken

      public tools.jackson.core.JsonToken getCurrentToken()
      Returns:
      Current token at the point when exception was thrown, if available (null if not)