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 JsonDeserializer#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 |
|---|---|
| public static class | FromStringDeserializer.Std
"Chameleon" deserializer that works on simple types that are deserialized from a simple String. |
| pack-priv static class | |
| pack-priv static class |
| Access | Constructor and Description |
|---|---|
| protected |
| Modifier and Type | Method and Description |
|---|---|
| protected abstract T | _deserialize(String value, DeserializationContext ctxt)
Main method from trying to deserialize actual value from non-empty String. |
| protected T | _deserializeEmbedded(Object ob, DeserializationContext ctxt)
Overridable method to allow coercion from embedded value that is neither
|
| protected final T | |
| protected Object | |
| protected Object | |
| protected Object | |
| protected boolean | |
| public T | deserialize(JsonParser
Parsed used for reading JSON content p, DeserializationContext Context that can be used to access information about
this deserialization activity. ctxt)Implements abstract com. |
| public static FromStringDeserializer | findDeserializer(Class<?> rawType)
Factory method for trying to find a deserializer for one of supported types that have simple from-String serialization. |
| public LogicalType | logicalType()
Overrides com. |
| public static Class |
| FromStringDeserializer | back to summary |
|---|---|
| protected FromStringDeserializer(Class<?> vc) | |
| _deserialize | back to summary |
|---|---|
| protected abstract T _deserialize(String value, DeserializationContext ctxt) throws IOException Main method from trying to deserialize actual value from non-empty String. | |
| _deserializeEmbedded | back to summary |
|---|---|
| protected T _deserializeEmbedded(Object ob, DeserializationContext ctxt) throws IOException Overridable method to allow coercion from embedded value that is neither
| |
| _deserializeFromEmptyString | back to summary |
|---|---|
| protected final T _deserializeFromEmptyString() throws IOException
Deprecated
| |
| _deserializeFromEmptyString | back to summary |
|---|---|
protected Object _deserializeFromEmptyString(DeserializationContext ctxt) throws IOException
| |
| _deserializeFromEmptyStringDefault | back to summary |
|---|---|
protected Object _deserializeFromEmptyStringDefault(DeserializationContext ctxt) throws IOException
| |
| _deserializeFromOther | back to summary |
|---|---|
| protected Object _deserializeFromOther(JsonParser p, DeserializationContext ctxt, JsonToken t) throws IOException | |
| _shouldTrim | back to summary |
|---|---|
| protected boolean _shouldTrim() | |
| deserialize | back to summary |
|---|---|
| public T deserialize(JsonParser p, DeserializationContext ctxt) throws IOException Implements abstract com. Doc from com. 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). Note that this method is never called for JSON null literal, and thus deserializers need (and should) not check for it.
| |
| findDeserializer | back to summary |
|---|---|
| public static FromStringDeserializer Factory method for trying to find a deserializer for one of supported types that have simple from-String serialization. | |
| logicalType | back to summary |
|---|---|
| public LogicalType logicalType() Overrides com. Doc from com. 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.
| |
| types | back to summary |
|---|---|
| public static Class | |
| Modifier and Type | Field and Description |
|---|---|
| protected final int | |
| protected static final String | |
| private static final long | |
| 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 |
| Modifier and Type | Method and Description |
|---|---|
| protected Object | _deserialize(String value, DeserializationContext ctxt)
Implements abstract com. |
| private Locale | |
| protected Object | |
| private Locale | |
| protected int | |
| protected boolean | |
| public Object | getEmptyValue(DeserializationContext ctxt)
Overrides com. |
| _kind | back to summary |
|---|---|
| protected final int _kind | |
| LOCALE_EXT_MARKER | back to summary |
|---|---|
| protected static final String LOCALE_EXT_MARKER | |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID Hides com. | |
| 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_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 | |
| Std | back to summary |
|---|---|
| protected Std(Class<?> valueType, int kind) | |
| _deserialize | back to summary |
|---|---|
| protected Object _deserialize(String value, DeserializationContext ctxt) throws IOException Implements abstract com. Doc from com. Main method from trying to deserialize actual value from non-empty String.
| |
| _deSerializeBCP47Locale | back to summary |
|---|---|
| private Locale _deSerializeBCP47Locale(String value, int ix, String first, String second, int extMarkerIx) | |
| _deserializeFromEmptyStringDefault | back to summary |
|---|---|
| protected Object _deserializeFromEmptyStringDefault(DeserializationContext ctxt) throws IOException Overrides com.
| |
| _deserializeLocale | back to summary |
|---|---|
| private Locale _deserializeLocale(String value, DeserializationContext ctxt) throws IOException | |
| _firstHyphenOrUnderscore | back to summary |
|---|---|
| protected int _firstHyphenOrUnderscore(String str) | |
| _shouldTrim | back to summary |
|---|---|
| protected boolean _shouldTrim() Overrides com.
| |
| getEmptyValue | back to summary |
|---|---|
| public Object getEmptyValue(DeserializationContext ctxt) throws JsonMappingException Overrides com. Doc from com. 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
| |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| protected Object | _deserialize(String value, DeserializationContext ctxt)
Implements abstract com. |
| public Object | deserialize(JsonParser
Parsed used for reading JSON content p, DeserializationContext Context that can be used to access information about
this deserialization activity. ctxt)Overrides com. |
| public Object | getEmptyValue(DeserializationContext ctxt)
Overrides com. |
| public LogicalType | logicalType()
Overrides com. |
| StringBufferDeserializer | back to summary |
|---|---|
| public StringBufferDeserializer() | |
| _deserialize | back to summary |
|---|---|
| protected Object _deserialize(String value, DeserializationContext ctxt) throws IOException Implements abstract com. Doc from com. Main method from trying to deserialize actual value from non-empty String.
| |
| deserialize | back to summary |
|---|---|
| public Object deserialize(JsonParser p, DeserializationContext ctxt) throws IOException Overrides com. Doc from com. 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). Note that this method is never called for JSON null literal, and thus deserializers need (and should) not check for it.
| |
| getEmptyValue | back to summary |
|---|---|
| public Object getEmptyValue(DeserializationContext ctxt) Overrides com. Doc from com. 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 com. Doc from com. 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 |
|---|---|
| protected Object | _deserialize(String value, DeserializationContext ctxt)
Implements abstract com. |
| public Object | deserialize(JsonParser
Parsed used for reading JSON content p, DeserializationContext Context that can be used to access information about
this deserialization activity. ctxt)Overrides com. |
| public Object | getEmptyValue(DeserializationContext ctxt)
Overrides com. |
| public LogicalType | logicalType()
Overrides com. |
| StringBuilderDeserializer | back to summary |
|---|---|
| public StringBuilderDeserializer() | |
| _deserialize | back to summary |
|---|---|
| protected Object _deserialize(String value, DeserializationContext ctxt) throws IOException Implements abstract com. Doc from com. Main method from trying to deserialize actual value from non-empty String.
| |
| deserialize | back to summary |
|---|---|
| public Object deserialize(JsonParser p, DeserializationContext ctxt) throws IOException Overrides com. Doc from com. 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). Note that this method is never called for JSON null literal, and thus deserializers need (and should) not check for it.
| |
| getEmptyValue | back to summary |
|---|---|
| public Object getEmptyValue(DeserializationContext ctxt) throws JsonMappingException Overrides com. Doc from com. 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 com. Doc from com. 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.
| |