Top Description Fields Constructors Methods
com.fasterxml.jackson.core.exc

public Class InputCoercionException

extends StreamReadException
Class Inheritance
Imports
com.fasterxml.jackson.core.*, com.fasterxml.jackson.core.util.RequestPayload

Exception type for read-side problems that are not direct decoding ("parsing") problems (those would be reported as com.fasterxml.jackson.core.JsonParseExceptions), but rather result from failed attempts to convert specific Java value out of valid but incompatible input value. One example is numeric coercions where target number type's range does not allow mapping of too large/too small input value.
Since
2.10

Field Summary

Modifier and TypeField and Description
protected final JsonToken
_inputType

Input token that represents input value that failed to coerce.

protected final Class<?>
_targetType

Target type that input value failed to coerce to.

private static final long
Inherited from com.fasterxml.jackson.core.exc.StreamReadException:
_processor_requestPayload

Constructor Summary

AccessConstructor and Description
public
InputCoercionException(JsonParser
Parser in use at the point where failure occurred
p
,
String
Exception mesage to use
msg
,
JsonToken
Shape of input that failed to coerce
inputType
,
Class<?>
Target type of failed coercion
targetType
)

Constructor that uses current parsing location as location, and sets processor (accessible via getProcessor()) to specified parser.

Method Summary

Modifier and TypeMethod and Description
public JsonToken

Returns:

"Shape" of input for which coercion failed, as JsonToken
getInputType
()

Accessor for getting information about input type (in form of token, giving "shape" of input) for which coercion failed.

public Class<?>

Returns:

Target type of failed conversion
getTargetType
()

Accessor for getting information about target type (in form of Java java.lang.Class) for which coercion failed.

public InputCoercionException
withParser(JsonParser
Parser instance to assign to this exception
p
)

Implements abstract com.fasterxml.jackson.core.exc.StreamReadException.withParser.

Fluent method that may be used to assign originating JsonParser, to be accessed using getProcessor().

public InputCoercionException
withRequestPayload(RequestPayload
Payload to assign to this exception
p
)

Implements abstract com.fasterxml.jackson.core.exc.StreamReadException.withRequestPayload.

Fluent method that may be used to assign payload to this exception, to let recipient access it for diagnostics purposes.

Inherited from com.fasterxml.jackson.core.exc.StreamReadException:
getMessagegetProcessorgetRequestPayloadgetRequestPayloadAsString

Field Detail

_inputTypeback to summary
protected final JsonToken _inputType

Input token that represents input value that failed to coerce.

_targetTypeback to summary
protected final Class<?> _targetType

Target type that input value failed to coerce to.

serialVersionUIDback to summary
private static final long serialVersionUID

Hides com.fasterxml.jackson.core.exc.StreamReadException.serialVersionUID.

Constructor Detail

InputCoercionExceptionback to summary
public InputCoercionException(JsonParser p, String msg, JsonToken inputType, Class<?> targetType)

Constructor that uses current parsing location as location, and sets processor (accessible via getProcessor()) to specified parser.

Parameters
p:JsonParser

Parser in use at the point where failure occurred

msg:String

Exception mesage to use

inputType:JsonToken

Shape of input that failed to coerce

targetType:Class<?>

Target type of failed coercion

Method Detail

getInputTypeback to summary
public JsonToken getInputType()

Accessor for getting information about input type (in form of token, giving "shape" of input) for which coercion failed.

Returns:JsonToken

"Shape" of input for which coercion failed, as JsonToken

getTargetTypeback to summary
public Class<?> getTargetType()

Accessor for getting information about target type (in form of Java java.lang.Class) for which coercion failed.

Returns:Class<?>

Target type of failed conversion

withParserback to summary
public InputCoercionException withParser(JsonParser p)

Implements abstract com.fasterxml.jackson.core.exc.StreamReadException.withParser.

Fluent method that may be used to assign originating JsonParser, to be accessed using getProcessor().

Note

`this` instance is modified and no new instance is constructed.

Parameters
p:JsonParser

Doc from com.fasterxml.jackson.core.exc.StreamReadException.withParser.

Parser instance to assign to this exception

Returns:InputCoercionException

Doc from com.fasterxml.jackson.core.exc.StreamReadException.withParser.

This exception instance to allow call chaining

Annotations
@Override
withRequestPayloadback to summary
public InputCoercionException withRequestPayload(RequestPayload p)

Implements abstract com.fasterxml.jackson.core.exc.StreamReadException.withRequestPayload.

Doc from com.fasterxml.jackson.core.exc.StreamReadException.withRequestPayload.

Fluent method that may be used to assign payload to this exception, to let recipient access it for diagnostics purposes.

Note

`this` instance is modified and no new instance is constructed.

Parameters
p:RequestPayload

Payload to assign to this exception

Returns:InputCoercionException

This exception instance to allow call chaining

Annotations
@Override