java.lang.String#trim .
Partial deserializer implementation will try to first access current token as
a String, calls _deserialize(String,DeserializationContext) and
returns return value.
If this does not work (current token not a simple scalar type), attempts
are made so that:
JsonToken#VALUE_EMBEDDED_OBJECT) are returned as-is
if they are of compatible type
DeserializationFeature#UNWRAP_SINGLE_VALUE_ARRAYS
is enabled, and array contains just a single scalar value that can be deserialized
(for example, JSON Array with single JSON String element).
Special handling includes:
JsonToken#VALUE_NULL) are handled by returning value
returned by ValueDeserializer#getNullValue(DeserializationContext): default
implementation simply returns Java `null` but this may be overridden.
_deserializeFromEmptyString
getting called, and return value being returned as deserialization: default implementation
simply returns `null`.
| Modifier and Type | Class and Description |
|---|---|
| private static class | |
| pack-priv static class | |
| pack-priv static class |
| Modifier and Type | Field and Description |
|---|---|
| protected final int | |
| public static final int | |
| public static final int | |
| public static final int | |
| public static final int | |
| public static final int | |
| public static final int | |
| public static final int | |
| public static final int | |
| public static final int | |
| public static final int | |
| public static final int | |
| public static final int | |
| public static final int |
| Access | Constructor and Description |
|---|---|
| protected |
| Modifier and Type | Method and Description |
|---|---|
| public Object | _deserialize(String value, DeserializationContext ctxt)
Implements abstract tools. Main method from trying to deserialize actual value from non-empty String. |
| protected Object | |
| private Locale | |
| protected int | |
| protected boolean | |
| public static JDKFromStringDeserializer | findDeserializer(Class<?> rawType)
Factory method for trying to find a deserializer for one of supported types that have simple from-String serialization. |
| public Object | getEmptyValue(DeserializationContext ctxt)
Overrides tools. Method called to determine value to be used for "empty" values (most commonly when deserializing from empty JSON Strings). |
| public static Class |
| _kind | back to summary |
|---|---|
| protected final int _kind | |
| STD_CHARSET | back to summary |
|---|---|
| public static final int STD_CHARSET | |
| STD_CLASS | back to summary |
|---|---|
| public static final int STD_CLASS | |
| STD_CURRENCY | back to summary |
|---|---|
| public static final int STD_CURRENCY | |
| STD_FILE | back to summary |
|---|---|
| public static final int STD_FILE | |
| STD_INET_ADDRESS | back to summary |
|---|---|
| public static final int STD_INET_ADDRESS | |
| STD_INET_SOCKET_ADDRESS | back to summary |
|---|---|
| public static final int STD_INET_SOCKET_ADDRESS | |
| STD_JAVA_TYPE | back to summary |
|---|---|
| public static final int STD_JAVA_TYPE | |
| STD_LOCALE | back to summary |
|---|---|
| public static final int STD_LOCALE | |
| STD_PATH | back to summary |
|---|---|
| public static final int STD_PATH | |
| STD_PATTERN | back to summary |
|---|---|
| public static final int STD_PATTERN | |
| STD_TIME_ZONE | back to summary |
|---|---|
| public static final int STD_TIME_ZONE | |
| STD_URI | back to summary |
|---|---|
| public static final int STD_URI | |
| STD_URL | back to summary |
|---|---|
| public static final int STD_URL | |
| JDKFromStringDeserializer | back to summary |
|---|---|
| protected JDKFromStringDeserializer(Class<?> valueType, int kind) | |
| _deserialize | back to summary |
|---|---|
| public Object _deserialize(String value, DeserializationContext ctxt) throws JacksonException, MalformedURLException, UnknownHostException Implements abstract tools. Doc from tools. Main method from trying to deserialize actual value from non-empty String.
| |
| _deserializeFromEmptyStringDefault | back to summary |
|---|---|
| protected Object _deserializeFromEmptyStringDefault(DeserializationContext ctxt) throws JacksonException Overrides tools.
| |
| _deserializeLocale | back to summary |
|---|---|
private Locale _deserializeLocale(String fullValue, DeserializationContext ctxt) throws JacksonException
| |
| _firstHyphenOrUnderscore | back to summary |
|---|---|
| protected int _firstHyphenOrUnderscore(String str) | |
| _shouldTrim | back to summary |
|---|---|
| protected boolean _shouldTrim() Overrides tools.
| |
| findDeserializer | back to summary |
|---|---|
| public static JDKFromStringDeserializer findDeserializer(Class<?> rawType) Factory method for trying to find a deserializer for one of supported types that have simple from-String serialization. | |
| getEmptyValue | back to summary |
|---|---|
| public Object getEmptyValue(DeserializationContext ctxt) Overrides tools. Doc from tools. Method called to determine value to be used for "empty" values
(most commonly when deserializing from empty JSON Strings).
Usually this is same as
This method may be called once, or multiple times, depending on what
Default implementation simply calls
| |
| types | back to summary |
|---|---|
| public static Class | |
| Modifier and Type | Field and Description |
|---|---|
| private static final boolean |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static Path |
| areWindowsFilePathsSupported | back to summary |
|---|---|
| private static final boolean areWindowsFilePathsSupported | |
| NioPathHelper | back to summary |
|---|---|
| private NioPathHelper() | |
| deserialize | back to summary |
|---|---|
| public static Path deserialize(DeserializationContext ctxt, String value) throws JacksonException | |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public Object | _deserialize(String value, DeserializationContext ctxt)
Overrides tools. Main method from trying to deserialize actual value from non-empty String. |
| public Object | deserialize(JsonParser p, DeserializationContext ctxt)
Overrides tools. Method that can be called to ask implementation to deserialize JSON content into the value type this serializer handles. |
| public Object | getEmptyValue(DeserializationContext ctxt)
Overrides tools. Method called to determine value to be used for "empty" values (most commonly when deserializing from empty JSON Strings). |
| public LogicalType | logicalType()
Overrides tools. Method for accessing logical type of values this deserializer produces. |
| StringBufferDeserializer | back to summary |
|---|---|
| public StringBufferDeserializer() | |
| _deserialize | back to summary |
|---|---|
| public Object _deserialize(String value, DeserializationContext ctxt) Overrides tools. Doc from tools. Main method from trying to deserialize actual value from non-empty String.
| |
| deserialize | back to summary |
|---|---|
| public Object deserialize(JsonParser p, DeserializationContext ctxt) throws JacksonException Overrides tools. Doc from tools. Method that can be called to ask implementation to deserialize JSON content into the value type this serializer handles. Returned instance is to be constructed by method itself. Pre-condition for this method is that the parser points to the first event that is part of value to deserializer (and which is never JSON 'null' literal, more on this below): for simple types it may be the only value; and for structured types the Object start marker or a FIELD_NAME. The two possible input conditions for structured types result from polymorphism via fields. In the ordinary case, Jackson calls this method when it has encountered an OBJECT_START, and the method implementation must advance to the next token to see the first field name. If the application configures polymorphism via a field, then the object looks like the following.
{
"@class": "class name",
...
}
Jackson consumes the two tokens (the @class field name
and its value) in order to learn the class and select the deserializer.
Thus, the stream is pointing to the FIELD_NAME for the first field
after the @class. Thus, if you want your method to work correctly
both with and without polymorphism, you must begin your method with:
if (p.currentToken() == JsonToken.START_OBJECT) {
p.nextToken();
}
This results in the stream pointing to the field name, so that
the two conditions align.
Post-condition is that the parser will point to the last event that is part of deserialized value (or in case deserialization fails, event that was not recognized or usable, which may be the same event as the one it pointed to upon call).
Handling null values (JsonToken.VALUE_NULL)
| |
| getEmptyValue | back to summary |
|---|---|
| public Object getEmptyValue(DeserializationContext ctxt) Overrides tools. Doc from tools. Method called to determine value to be used for "empty" values
(most commonly when deserializing from empty JSON Strings).
Usually this is same as
This method may be called once, or multiple times, depending on what
Default implementation simply calls
| |
| logicalType | back to summary |
|---|---|
| public LogicalType logicalType() Overrides tools. Doc from tools. Method for accessing logical type of values this deserializer produces. Typically used for further configuring handling of values, for example, to find which coercions are legal.
| |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public Object | _deserialize(String value, DeserializationContext ctxt)
Overrides tools. Main method from trying to deserialize actual value from non-empty String. |
| public Object | deserialize(JsonParser p, DeserializationContext ctxt)
Overrides tools. Method that can be called to ask implementation to deserialize JSON content into the value type this serializer handles. |
| public Object | getEmptyValue(DeserializationContext ctxt)
Overrides tools. Method called to determine value to be used for "empty" values (most commonly when deserializing from empty JSON Strings). |
| public LogicalType | logicalType()
Overrides tools. Method for accessing logical type of values this deserializer produces. |
| StringBuilderDeserializer | back to summary |
|---|---|
| public StringBuilderDeserializer() | |
| _deserialize | back to summary |
|---|---|
| public Object _deserialize(String value, DeserializationContext ctxt) Overrides tools. Doc from tools. Main method from trying to deserialize actual value from non-empty String.
| |
| deserialize | back to summary |
|---|---|
| public Object deserialize(JsonParser p, DeserializationContext ctxt) throws JacksonException Overrides tools. Doc from tools. Method that can be called to ask implementation to deserialize JSON content into the value type this serializer handles. Returned instance is to be constructed by method itself. Pre-condition for this method is that the parser points to the first event that is part of value to deserializer (and which is never JSON 'null' literal, more on this below): for simple types it may be the only value; and for structured types the Object start marker or a FIELD_NAME. The two possible input conditions for structured types result from polymorphism via fields. In the ordinary case, Jackson calls this method when it has encountered an OBJECT_START, and the method implementation must advance to the next token to see the first field name. If the application configures polymorphism via a field, then the object looks like the following.
{
"@class": "class name",
...
}
Jackson consumes the two tokens (the @class field name
and its value) in order to learn the class and select the deserializer.
Thus, the stream is pointing to the FIELD_NAME for the first field
after the @class. Thus, if you want your method to work correctly
both with and without polymorphism, you must begin your method with:
if (p.currentToken() == JsonToken.START_OBJECT) {
p.nextToken();
}
This results in the stream pointing to the field name, so that
the two conditions align.
Post-condition is that the parser will point to the last event that is part of deserialized value (or in case deserialization fails, event that was not recognized or usable, which may be the same event as the one it pointed to upon call).
Handling null values (JsonToken.VALUE_NULL)
| |
| getEmptyValue | back to summary |
|---|---|
| public Object getEmptyValue(DeserializationContext ctxt) Overrides tools. Doc from tools. Method called to determine value to be used for "empty" values
(most commonly when deserializing from empty JSON Strings).
Usually this is same as
This method may be called once, or multiple times, depending on what
Default implementation simply calls
| |
| logicalType | back to summary |
|---|---|
| public LogicalType logicalType() Overrides tools. Doc from tools. Method for accessing logical type of values this deserializer produces. Typically used for further configuring handling of values, for example, to find which coercions are legal.
| |