Class MismatchedInputException

  • All Implemented Interfaces:
    java.io.Serializable
    Direct Known Subclasses:
    InvalidFormatException, InvalidNullException, InvalidTypeIdException, PropertyBindingException

    public class MismatchedInputException
    extends JsonMappingException
    General exception type used as the base class for all JsonMappingExceptions 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
    • Field Detail

      • _targetType

        protected java.lang.Class<?> _targetType
        Type of value that was to be deserialized
    • Constructor Detail

      • MismatchedInputException

        protected MismatchedInputException​(com.fasterxml.jackson.core.JsonParser p,
                                           java.lang.String msg)
      • MismatchedInputException

        protected MismatchedInputException​(com.fasterxml.jackson.core.JsonParser p,
                                           java.lang.String msg,
                                           com.fasterxml.jackson.core.JsonLocation loc)
      • MismatchedInputException

        protected MismatchedInputException​(com.fasterxml.jackson.core.JsonParser p,
                                           java.lang.String msg,
                                           java.lang.Class<?> targetType)
      • MismatchedInputException

        protected MismatchedInputException​(com.fasterxml.jackson.core.JsonParser p,
                                           java.lang.String msg,
                                           JavaType targetType)
    • Method Detail

      • from

        @Deprecated
        public static MismatchedInputException from​(com.fasterxml.jackson.core.JsonParser p,
                                                    java.lang.String msg)
        Deprecated.
      • from

        public static MismatchedInputException from​(com.fasterxml.jackson.core.JsonParser p,
                                                    java.lang.Class<?> targetType,
                                                    java.lang.String msg)
      • getTargetType

        public java.lang.Class<?> getTargetType()
        Accessor for getting intended target type, with which input did not match, if known; `null` if not known for some reason.