Top Description Inners Fields Constructors Methods
tools.jackson.databind.deser.jdk

public Class JDKFromStringDeserializer

extends FromStringDeserializer<Object>
Class Inheritance
Known Direct Subclasses
tools.jackson.databind.deser.jdk.JDKFromStringDeserializer.StringBuilderDeserializer, tools.jackson.databind.deser.jdk.JDKFromStringDeserializer.StringBufferDeserializer
Imports
java.io.*, java.net.*, java.nio.charset.Charset, java.nio.file.FileSystemNotFoundException, .Path, .Paths, java.nio.file.spi.FileSystemProvider, java.util.*, java.util.regex.Pattern, .PatternSyntaxException, tools.jackson.core.*, tools.jackson.core.util.VersionUtil, tools.jackson.databind.*, tools.jackson.databind.deser.std.FromStringDeserializer, tools.jackson.databind.exc.InvalidFormatException, tools.jackson.databind.type.LogicalType, tools.jackson.databind.util.ClassUtil

Base class for simple deserializers that serialize values from String representation: this includes JSON Strings and other Scalar values that can be coerced into text, like Numbers and Booleans). Simple JSON String values are trimmed using 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:

Special handling includes:

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
pack-priv static class
pack-priv static class

Field Summary

Modifier and TypeField 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

Constructor Summary

AccessConstructor and Description
protected
JDKFromStringDeserializer(Class<?> valueType, int kind)

Method Summary

Modifier and TypeMethod and Description
public Object
_deserialize(String value, DeserializationContext ctxt)

Implements abstract tools.jackson.databind.deser.std.FromStringDeserializer._deserialize.

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.jackson.databind.ValueDeserializer.getEmptyValue.

Method called to determine value to be used for "empty" values (most commonly when deserializing from empty JSON Strings).

public static Class<?>[]
Inherited from tools.jackson.databind.deser.std.FromStringDeserializer:
_deserializeEmbedded_deserializeFromEmptyString_deserializeFromOtherdeserializelogicalType

Field Detail

_kindback to summary
protected final int _kind
STD_CHARSETback to summary
public static final int STD_CHARSET
STD_CLASSback to summary
public static final int STD_CLASS
STD_CURRENCYback to summary
public static final int STD_CURRENCY
STD_FILEback to summary
public static final int STD_FILE
STD_INET_ADDRESSback to summary
public static final int STD_INET_ADDRESS
STD_INET_SOCKET_ADDRESSback to summary
public static final int STD_INET_SOCKET_ADDRESS
STD_JAVA_TYPEback to summary
public static final int STD_JAVA_TYPE
STD_LOCALEback to summary
public static final int STD_LOCALE
STD_PATHback to summary
public static final int STD_PATH
STD_PATTERNback to summary
public static final int STD_PATTERN
STD_TIME_ZONEback to summary
public static final int STD_TIME_ZONE
STD_URIback to summary
public static final int STD_URI
STD_URLback to summary
public static final int STD_URL

Constructor Detail

JDKFromStringDeserializerback to summary
protected JDKFromStringDeserializer(Class<?> valueType, int kind)

Method Detail

_deserializeback to summary
public Object _deserialize(String value, DeserializationContext ctxt) throws JacksonException, MalformedURLException, UnknownHostException

Implements abstract tools.jackson.databind.deser.std.FromStringDeserializer._deserialize.

Doc from tools.jackson.databind.deser.std.FromStringDeserializer._deserialize.

Main method from trying to deserialize actual value from non-empty String.

Annotations
@Override
_deserializeFromEmptyStringDefaultback to summary
protected Object _deserializeFromEmptyStringDefault(DeserializationContext ctxt) throws JacksonException

Overrides tools.jackson.databind.deser.std.FromStringDeserializer._deserializeFromEmptyStringDefault.

Annotations
@Override
_deserializeLocaleback to summary
private Locale _deserializeLocale(String fullValue, DeserializationContext ctxt) throws JacksonException
Annotations
@SuppressWarnings:deprecation
_firstHyphenOrUnderscoreback to summary
protected int _firstHyphenOrUnderscore(String str)
_shouldTrimback to summary
protected boolean _shouldTrim()

Overrides tools.jackson.databind.deser.std.FromStringDeserializer._shouldTrim.

Annotations
@Override
findDeserializerback 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.

getEmptyValueback to summary
public Object getEmptyValue(DeserializationContext ctxt)

Overrides tools.jackson.databind.ValueDeserializer.getEmptyValue.

Doc from tools.jackson.databind.ValueDeserializer.getEmptyValue.

Method called to determine value to be used for "empty" values (most commonly when deserializing from empty JSON Strings). Usually this is same as getNullValue (which in turn is usually simply Java null), but it can be overridden for specific types. Or, if type should never be converted from empty String, method can also throw an exception.

This method may be called once, or multiple times, depending on what getEmptyAccessPattern() returns.

Default implementation simply calls getNullValue and returns value.

Annotations
@Override
typesback to summary
public static Class<?>[] types()
tools.jackson.databind.deser.jdk back to summary

private Class JDKFromStringDeserializer.NioPathHelper

extends Object
Class Inheritance
  • java.lang.Object
  • tools.jackson.databind.deser.jdk.JDKFromStringDeserializer.NioPathHelper

Field Summary

Modifier and TypeField and Description
private static final boolean

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static Path
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

areWindowsFilePathsSupportedback to summary
private static final boolean areWindowsFilePathsSupported

Constructor Detail

NioPathHelperback to summary
private NioPathHelper()

Method Detail

deserializeback to summary
public static Path deserialize(DeserializationContext ctxt, String value) throws JacksonException
tools.jackson.databind.deser.jdk back to summary

pack-priv Class JDKFromStringDeserializer.StringBufferDeserializer

extends JDKFromStringDeserializer
Class Inheritance

Field Summary

Inherited from tools.jackson.databind.deser.jdk.JDKFromStringDeserializer:
_kindSTD_CHARSETSTD_CLASSSTD_CURRENCYSTD_FILESTD_INET_ADDRESSSTD_INET_SOCKET_ADDRESSSTD_JAVA_TYPESTD_LOCALESTD_PATHSTD_PATTERNSTD_TIME_ZONESTD_URISTD_URL

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public Object
_deserialize(String value, DeserializationContext ctxt)

Overrides tools.jackson.databind.deser.jdk.JDKFromStringDeserializer._deserialize.

Main method from trying to deserialize actual value from non-empty String.

public Object
deserialize(JsonParser p, DeserializationContext ctxt)

Overrides tools.jackson.databind.deser.std.FromStringDeserializer.deserialize.

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.jackson.databind.deser.jdk.JDKFromStringDeserializer.getEmptyValue.

Method called to determine value to be used for "empty" values (most commonly when deserializing from empty JSON Strings).

public LogicalType
logicalType()

Overrides tools.jackson.databind.deser.std.FromStringDeserializer.logicalType.

Method for accessing logical type of values this deserializer produces.

Inherited from tools.jackson.databind.deser.jdk.JDKFromStringDeserializer:
_deserializeFromEmptyStringDefault_firstHyphenOrUnderscore_shouldTrimfindDeserializertypes

Constructor Detail

StringBufferDeserializerback to summary
public StringBufferDeserializer()

Method Detail

_deserializeback to summary
public Object _deserialize(String value, DeserializationContext ctxt)

Overrides tools.jackson.databind.deser.jdk.JDKFromStringDeserializer._deserialize.

Doc from tools.jackson.databind.deser.std.FromStringDeserializer._deserialize.

Main method from trying to deserialize actual value from non-empty String.

Annotations
@Override
deserializeback to summary
public Object deserialize(JsonParser p, DeserializationContext ctxt) throws JacksonException

Overrides tools.jackson.databind.deser.std.FromStringDeserializer.deserialize.

Doc from tools.jackson.databind.ValueDeserializer.deserialize.

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)
: Note that this method is never called for the JSON null literal to avoid every deserializer from having to handle null values. Instead, the ValueDeserializer#getNullValue(DeserializationContext) method is called to produce a null value. To influence null handling, custom deserializers should override ValueDeserializer#getNullValue(DeserializationContext) and usually also ValueDeserializer#getNullAccessPattern().

Annotations
@Override
getEmptyValueback to summary
public Object getEmptyValue(DeserializationContext ctxt)

Overrides tools.jackson.databind.deser.jdk.JDKFromStringDeserializer.getEmptyValue.

Doc from tools.jackson.databind.ValueDeserializer.getEmptyValue.

Method called to determine value to be used for "empty" values (most commonly when deserializing from empty JSON Strings). Usually this is same as getNullValue (which in turn is usually simply Java null), but it can be overridden for specific types. Or, if type should never be converted from empty String, method can also throw an exception.

This method may be called once, or multiple times, depending on what getEmptyAccessPattern() returns.

Default implementation simply calls getNullValue and returns value.

Annotations
@Override
logicalTypeback to summary
public LogicalType logicalType()

Overrides tools.jackson.databind.deser.std.FromStringDeserializer.logicalType.

Doc from tools.jackson.databind.ValueDeserializer.logicalType.

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.

Annotations
@Override
tools.jackson.databind.deser.jdk back to summary

pack-priv Class JDKFromStringDeserializer.StringBuilderDeserializer

extends JDKFromStringDeserializer
Class Inheritance

Field Summary

Inherited from tools.jackson.databind.deser.jdk.JDKFromStringDeserializer:
_kindSTD_CHARSETSTD_CLASSSTD_CURRENCYSTD_FILESTD_INET_ADDRESSSTD_INET_SOCKET_ADDRESSSTD_JAVA_TYPESTD_LOCALESTD_PATHSTD_PATTERNSTD_TIME_ZONESTD_URISTD_URL

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public Object
_deserialize(String value, DeserializationContext ctxt)

Overrides tools.jackson.databind.deser.jdk.JDKFromStringDeserializer._deserialize.

Main method from trying to deserialize actual value from non-empty String.

public Object
deserialize(JsonParser p, DeserializationContext ctxt)

Overrides tools.jackson.databind.deser.std.FromStringDeserializer.deserialize.

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.jackson.databind.deser.jdk.JDKFromStringDeserializer.getEmptyValue.

Method called to determine value to be used for "empty" values (most commonly when deserializing from empty JSON Strings).

public LogicalType
logicalType()

Overrides tools.jackson.databind.deser.std.FromStringDeserializer.logicalType.

Method for accessing logical type of values this deserializer produces.

Inherited from tools.jackson.databind.deser.jdk.JDKFromStringDeserializer:
_deserializeFromEmptyStringDefault_firstHyphenOrUnderscore_shouldTrimfindDeserializertypes

Constructor Detail

StringBuilderDeserializerback to summary
public StringBuilderDeserializer()

Method Detail

_deserializeback to summary
public Object _deserialize(String value, DeserializationContext ctxt)

Overrides tools.jackson.databind.deser.jdk.JDKFromStringDeserializer._deserialize.

Doc from tools.jackson.databind.deser.std.FromStringDeserializer._deserialize.

Main method from trying to deserialize actual value from non-empty String.

Annotations
@Override
deserializeback to summary
public Object deserialize(JsonParser p, DeserializationContext ctxt) throws JacksonException

Overrides tools.jackson.databind.deser.std.FromStringDeserializer.deserialize.

Doc from tools.jackson.databind.ValueDeserializer.deserialize.

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)
: Note that this method is never called for the JSON null literal to avoid every deserializer from having to handle null values. Instead, the ValueDeserializer#getNullValue(DeserializationContext) method is called to produce a null value. To influence null handling, custom deserializers should override ValueDeserializer#getNullValue(DeserializationContext) and usually also ValueDeserializer#getNullAccessPattern().

Annotations
@Override
getEmptyValueback to summary
public Object getEmptyValue(DeserializationContext ctxt)

Overrides tools.jackson.databind.deser.jdk.JDKFromStringDeserializer.getEmptyValue.

Doc from tools.jackson.databind.ValueDeserializer.getEmptyValue.

Method called to determine value to be used for "empty" values (most commonly when deserializing from empty JSON Strings). Usually this is same as getNullValue (which in turn is usually simply Java null), but it can be overridden for specific types. Or, if type should never be converted from empty String, method can also throw an exception.

This method may be called once, or multiple times, depending on what getEmptyAccessPattern() returns.

Default implementation simply calls getNullValue and returns value.

Annotations
@Override
logicalTypeback to summary
public LogicalType logicalType()

Overrides tools.jackson.databind.deser.std.FromStringDeserializer.logicalType.

Doc from tools.jackson.databind.ValueDeserializer.logicalType.

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.

Annotations
@Override