Class StdDeserializer<T>

    • Field Detail

      • F_MASK_ACCEPT_ARRAYS

        @Deprecated
        protected static final int F_MASK_ACCEPT_ARRAYS
        Deprecated.
      • _valueClass

        protected final java.lang.Class<?> _valueClass
        Type of values this deserializer handles: sometimes exact types, other time most specific supertype of types deserializer handles (which may be as generic as Object in some case)
      • _valueType

        protected final JavaType _valueType
    • Constructor Detail

      • StdDeserializer

        protected StdDeserializer​(java.lang.Class<?> vc)
      • StdDeserializer

        protected StdDeserializer​(JavaType valueType)
      • StdDeserializer

        protected StdDeserializer​(StdDeserializer<?> src)
        Copy-constructor for sub-classes to use, most often when creating new instances for ContextualDeserializer.
        Since:
        2.5
    • Method Detail

      • handledType

        public java.lang.Class<?> handledType()
        Description copied from class: JsonDeserializer
        Method for accessing concrete physical type of values this deserializer produces. Note that this information is not guaranteed to be exact -- it may be a more generic (super-type) -- but it should not be incorrect (return a non-related type).

        Default implementation will return null, which means almost same same as returning Object.class would; that is, that nothing is known about handled type.

        Overrides:
        handledType in class JsonDeserializer<T>
        Returns:
        Physical type of values this deserializer produces, if known; null if not
      • getValueClass

        @Deprecated
        public final java.lang.Class<?> getValueClass()
        Deprecated.
        Since 2.3 use handledType() instead
      • getValueType

        public JavaType getValueType()
        Exact structured type this deserializer handles, if known.
      • getValueType

        public JavaType getValueType​(DeserializationContext ctxt)
        Convenience method for getting handled type as JavaType, regardless of whether deserializer has one already resolved (and accessible via getValueType()) or not: equivalent to:
           if (getValueType() != null) {
                return getValueType();
           }
           return ctxt.constructType(handledType());
        
        Since:
        2.10
      • isDefaultDeserializer

        protected boolean isDefaultDeserializer​(JsonDeserializer<?> deserializer)
        Method that can be called to determine if given deserializer is the default deserializer Jackson uses; as opposed to a custom deserializer installed by a module or calling application. Determination is done using JacksonStdImpl annotation on deserializer class.
      • isDefaultKeyDeserializer

        protected boolean isDefaultKeyDeserializer​(KeyDeserializer keyDeser)
      • deserializeWithType

        public java.lang.Object deserializeWithType​(com.fasterxml.jackson.core.JsonParser p,
                                                    DeserializationContext ctxt,
                                                    TypeDeserializer typeDeserializer)
                                             throws java.io.IOException
        Base implementation that does not assume specific type inclusion mechanism. Sub-classes are expected to override this method if they are to handle type information.
        Overrides:
        deserializeWithType in class JsonDeserializer<T>
        typeDeserializer - Deserializer to use for handling type information
        Throws:
        java.io.IOException
      • _deserializeFromEmpty

        @Deprecated
        protected T _deserializeFromEmpty​(com.fasterxml.jackson.core.JsonParser p,
                                          DeserializationContext ctxt)
                                   throws java.io.IOException
        Deprecated.
        Since 2.12
        Helper method that may be used to support fallback for Empty String / Empty Array non-standard representations; usually for things serialized as JSON Objects.
        Throws:
        java.io.IOException
        Since:
        2.5
      • _deserializeFromString

        protected T _deserializeFromString​(com.fasterxml.jackson.core.JsonParser p,
                                           DeserializationContext ctxt)
                                    throws java.io.IOException
        Helper method to call in case deserializer does not support native automatic use of incoming String values, but there may be standard coercions to consider.
        Throws:
        java.io.IOException
        Since:
        2.12
      • _deserializeFromEmptyString

        protected java.lang.Object _deserializeFromEmptyString​(com.fasterxml.jackson.core.JsonParser p,
                                                               DeserializationContext ctxt,
                                                               CoercionAction act,
                                                               java.lang.Class<?> rawTargetType,
                                                               java.lang.String desc)
                                                        throws java.io.IOException
        Throws:
        java.io.IOException
      • _parseBooleanPrimitive

        @Deprecated
        protected final boolean _parseBooleanPrimitive​(DeserializationContext ctxt,
                                                       com.fasterxml.jackson.core.JsonParser p,
                                                       java.lang.Class<?> targetType)
                                                throws java.io.IOException
        Deprecated.
        Throws:
        java.io.IOException
      • _parseBooleanPrimitive

        protected final boolean _parseBooleanPrimitive​(com.fasterxml.jackson.core.JsonParser p,
                                                       DeserializationContext ctxt)
                                                throws java.io.IOException
        Parameters:
        ctxt - Deserialization context for accessing configuration
        p - Underlying parser
        Throws:
        java.io.IOException
      • _isTrue

        protected boolean _isTrue​(java.lang.String text)
      • _isFalse

        protected boolean _isFalse​(java.lang.String text)
      • _parseBoolean

        protected final java.lang.Boolean _parseBoolean​(com.fasterxml.jackson.core.JsonParser p,
                                                        DeserializationContext ctxt,
                                                        java.lang.Class<?> targetType)
                                                 throws java.io.IOException
        Helper method called for cases where non-primitive, boolean-based value is to be deserialized: result of this method will be Boolean, although actual target type may be something different.

        Note: does NOT dynamically access "empty value" or "null value" of deserializer since those values could be of type other than Boolean. Caller may need to translate from 3 possible result types into appropriately matching output types.

        Parameters:
        p - Underlying parser
        ctxt - Deserialization context for accessing configuration
        targetType - Actual type that is being deserialized, may be same as handledType() but could be AtomicBoolean for example. Used for coercion config access.
        Throws:
        java.io.IOException
        Since:
        2.12
      • _parseBytePrimitive

        protected final byte _parseBytePrimitive​(com.fasterxml.jackson.core.JsonParser p,
                                                 DeserializationContext ctxt)
                                          throws java.io.IOException
        Throws:
        java.io.IOException
      • _parseShortPrimitive

        protected final short _parseShortPrimitive​(com.fasterxml.jackson.core.JsonParser p,
                                                   DeserializationContext ctxt)
                                            throws java.io.IOException
        Throws:
        java.io.IOException
      • _parseIntPrimitive

        protected final int _parseIntPrimitive​(com.fasterxml.jackson.core.JsonParser p,
                                               DeserializationContext ctxt)
                                        throws java.io.IOException
        Throws:
        java.io.IOException
      • _parseIntPrimitive

        protected final int _parseIntPrimitive​(DeserializationContext ctxt,
                                               java.lang.String text)
                                        throws java.io.IOException
        Throws:
        java.io.IOException
        Since:
        2.9
      • _parseInteger

        protected final java.lang.Integer _parseInteger​(com.fasterxml.jackson.core.JsonParser p,
                                                        DeserializationContext ctxt,
                                                        java.lang.Class<?> targetType)
                                                 throws java.io.IOException
        Throws:
        java.io.IOException
        Since:
        2.12
      • _parseLongPrimitive

        protected final long _parseLongPrimitive​(com.fasterxml.jackson.core.JsonParser p,
                                                 DeserializationContext ctxt)
                                          throws java.io.IOException
        Throws:
        java.io.IOException
      • _parseLongPrimitive

        protected final long _parseLongPrimitive​(DeserializationContext ctxt,
                                                 java.lang.String text)
                                          throws java.io.IOException
        Throws:
        java.io.IOException
        Since:
        2.9
      • _parseLong

        protected final java.lang.Long _parseLong​(com.fasterxml.jackson.core.JsonParser p,
                                                  DeserializationContext ctxt,
                                                  java.lang.Class<?> targetType)
                                           throws java.io.IOException
        Throws:
        java.io.IOException
        Since:
        2.12
      • _parseFloatPrimitive

        protected final float _parseFloatPrimitive​(com.fasterxml.jackson.core.JsonParser p,
                                                   DeserializationContext ctxt)
                                            throws java.io.IOException
        Throws:
        java.io.IOException
      • _parseFloatPrimitive

        protected final float _parseFloatPrimitive​(DeserializationContext ctxt,
                                                   java.lang.String text)
                                            throws java.io.IOException
        Throws:
        java.io.IOException
        Since:
        2.9
      • _checkFloatSpecialValue

        protected java.lang.Float _checkFloatSpecialValue​(java.lang.String text)
        Helper method called to check whether given String value contains one of "special" values (currently, NaN ("not-a-number") and plus/minus Infinity) and if so, returns that value; otherwise returns null.
        Parameters:
        text - String value to check
        Returns:
        One of Float constants referring to special value decoded, if value matched; null otherwise.
        Since:
        2.12
      • _parseDoublePrimitive

        protected final double _parseDoublePrimitive​(com.fasterxml.jackson.core.JsonParser p,
                                                     DeserializationContext ctxt)
                                              throws java.io.IOException
        Throws:
        java.io.IOException
      • _parseDoublePrimitive

        protected final double _parseDoublePrimitive​(DeserializationContext ctxt,
                                                     java.lang.String text)
                                              throws java.io.IOException
        Throws:
        java.io.IOException
        Since:
        2.9
      • _parseDouble

        protected static final double _parseDouble​(java.lang.String numStr)
                                            throws java.lang.NumberFormatException
        Helper method for encapsulating calls to low-level double value parsing; single place just because we need a work-around that must be applied to all calls.
        Throws:
        java.lang.NumberFormatException
      • _checkDoubleSpecialValue

        protected java.lang.Double _checkDoubleSpecialValue​(java.lang.String text)
        Helper method called to check whether given String value contains one of "special" values (currently, NaN ("not-a-number") and plus/minus Infinity) and if so, returns that value; otherwise returns null.
        Parameters:
        text - String value to check
        Returns:
        One of Double constants referring to special value decoded, if value matched; null otherwise.
        Since:
        2.12
      • _parseDate

        protected java.util.Date _parseDate​(com.fasterxml.jackson.core.JsonParser p,
                                            DeserializationContext ctxt)
                                     throws java.io.IOException
        Throws:
        java.io.IOException
      • _parseDateFromArray

        protected java.util.Date _parseDateFromArray​(com.fasterxml.jackson.core.JsonParser p,
                                                     DeserializationContext ctxt)
                                              throws java.io.IOException
        Throws:
        java.io.IOException
      • _parseDate

        protected java.util.Date _parseDate​(java.lang.String value,
                                            DeserializationContext ctxt)
                                     throws java.io.IOException
        Throws:
        java.io.IOException
        Since:
        2.8
      • _parseString

        protected final java.lang.String _parseString​(com.fasterxml.jackson.core.JsonParser p,
                                                      DeserializationContext ctxt)
                                               throws java.io.IOException
        Helper method used for accessing String value, if possible, doing necessary conversion or throwing exception as necessary.
        Throws:
        java.io.IOException
        Since:
        2.1
      • _hasTextualNull

        protected boolean _hasTextualNull​(java.lang.String value)
        Helper method called to determine if we are seeing String value of "null", and, further, that it should be coerced to null just like null token.
        Since:
        2.3
      • _isNegInf

        protected final boolean _isNegInf​(java.lang.String text)
      • _isPosInf

        protected final boolean _isPosInf​(java.lang.String text)
      • _isNaN

        protected final boolean _isNaN​(java.lang.String text)
      • _isBlank

        protected static final boolean _isBlank​(java.lang.String text)
      • _checkFromStringCoercion

        protected CoercionAction _checkFromStringCoercion​(DeserializationContext ctxt,
                                                          java.lang.String value)
                                                   throws java.io.IOException
        Throws:
        java.io.IOException
        Since:
        2.12
      • _checkFromStringCoercion

        protected CoercionAction _checkFromStringCoercion​(DeserializationContext ctxt,
                                                          java.lang.String value,
                                                          LogicalType logicalType,
                                                          java.lang.Class<?> rawTargetType)
                                                   throws java.io.IOException
        Throws:
        java.io.IOException
        Since:
        2.12
      • _checkFloatToIntCoercion

        protected CoercionAction _checkFloatToIntCoercion​(com.fasterxml.jackson.core.JsonParser p,
                                                          DeserializationContext ctxt,
                                                          java.lang.Class<?> rawTargetType)
                                                   throws java.io.IOException
        Throws:
        java.io.IOException
        Since:
        2.12
      • _coerceBooleanFromInt

        protected java.lang.Boolean _coerceBooleanFromInt​(com.fasterxml.jackson.core.JsonParser p,
                                                          DeserializationContext ctxt,
                                                          java.lang.Class<?> rawTargetType)
                                                   throws java.io.IOException
        Throws:
        java.io.IOException
        Since:
        2.12
      • _checkCoercionFail

        protected CoercionAction _checkCoercionFail​(DeserializationContext ctxt,
                                                    CoercionAction act,
                                                    java.lang.Class<?> targetType,
                                                    java.lang.Object inputValue,
                                                    java.lang.String inputDesc)
                                             throws java.io.IOException
        Throws:
        java.io.IOException
        Since:
        2.12
      • _checkTextualNull

        protected boolean _checkTextualNull​(DeserializationContext ctxt,
                                            java.lang.String text)
                                     throws JsonMappingException
        Method called when otherwise unrecognized String value is encountered for a non-primitive type: should see if it is String value "null", and if so, whether it is acceptable according to configuration or not
        Throws:
        JsonMappingException
        Since:
        2.12
      • _verifyNullForPrimitive

        protected final void _verifyNullForPrimitive​(DeserializationContext ctxt)
                                              throws JsonMappingException
        Method called to verify that null token from input is acceptable for primitive (unboxed) target type. It should NOT be called if null was received by other means (coerced due to configuration, or even from optionally acceptable String "null" token).
        Throws:
        JsonMappingException
        Since:
        2.9
      • _verifyNullForPrimitiveCoercion

        protected final void _verifyNullForPrimitiveCoercion​(DeserializationContext ctxt,
                                                             java.lang.String str)
                                                      throws JsonMappingException
        Method called to verify that text value "null" from input is acceptable for primitive (unboxed) target type. It should not be called if actual null token was received, or if null is a result of coercion from Some other input type.
        Throws:
        JsonMappingException
        Since:
        2.9
      • _coercedTypeDesc

        protected java.lang.String _coercedTypeDesc()
        Helper method called to get a description of type into which a scalar value coercion is (most likely) being applied, to be used for constructing exception messages on coerce failure.
        Returns:
        Message with backtick-enclosed name of type this deserializer supports
        Since:
        2.9
      • _parseBooleanFromInt

        @Deprecated
        protected boolean _parseBooleanFromInt​(com.fasterxml.jackson.core.JsonParser p,
                                               DeserializationContext ctxt)
                                        throws java.io.IOException
        Deprecated.
        Throws:
        java.io.IOException
      • _failDoubleToIntCoercion

        @Deprecated
        protected void _failDoubleToIntCoercion​(com.fasterxml.jackson.core.JsonParser p,
                                                DeserializationContext ctxt,
                                                java.lang.String type)
                                         throws java.io.IOException
        Deprecated.
        Throws:
        java.io.IOException
      • _verifyNumberForScalarCoercion

        @Deprecated
        protected void _verifyNumberForScalarCoercion​(DeserializationContext ctxt,
                                                      com.fasterxml.jackson.core.JsonParser p)
                                               throws java.io.IOException
        Deprecated.
        Throws:
        java.io.IOException
      • _isEmptyOrTextualNull

        @Deprecated
        protected boolean _isEmptyOrTextualNull​(java.lang.String value)
        Deprecated.
      • findDeserializer

        protected JsonDeserializer<java.lang.Object> findDeserializer​(DeserializationContext ctxt,
                                                                      JavaType type,
                                                                      BeanProperty property)
                                                               throws JsonMappingException
        Helper method used to locate deserializers for properties the type this deserializer handles contains (usually for properties of bean types)
        Parameters:
        type - Type of property to deserialize
        property - Actual property object (field, method, constuctor parameter) used for passing deserialized values; provided so deserializer can be contextualized if necessary
        Throws:
        JsonMappingException
      • _isIntNumber

        protected final boolean _isIntNumber​(java.lang.String text)
        Helper method to check whether given text refers to what looks like a clean simple integer number, consisting of optional sign followed by a sequence of digits.

        Note that definition is quite loose as leading zeroes are allowed, in addition to plus sign (not just minus).

      • findConvertingContentDeserializer

        protected JsonDeserializer<?> findConvertingContentDeserializer​(DeserializationContext ctxt,
                                                                        BeanProperty prop,
                                                                        JsonDeserializer<?> existingDeserializer)
                                                                 throws JsonMappingException
        Helper method that can be used to see if specified property has annotation indicating that a converter is to be used for contained values (contents of structured types; array/List/Map values)
        Parameters:
        existingDeserializer - (optional) configured content serializer if one already exists.
        Throws:
        JsonMappingException
        Since:
        2.2
      • findFormatOverrides

        protected com.fasterxml.jackson.annotation.JsonFormat.Value findFormatOverrides​(DeserializationContext ctxt,
                                                                                        BeanProperty prop,
                                                                                        java.lang.Class<?> typeForDefaults)
        Helper method that may be used to find if this deserializer has specific JsonFormat settings, either via property, or through type-specific defaulting.
        Parameters:
        typeForDefaults - Type (erased) used for finding default format settings, if any
        Since:
        2.7
      • handleUnknownProperty

        protected void handleUnknownProperty​(com.fasterxml.jackson.core.JsonParser p,
                                             DeserializationContext ctxt,
                                             java.lang.Object instanceOrClass,
                                             java.lang.String propName)
                                      throws java.io.IOException
        Method called to deal with a property that did not map to a known Bean property. Method can deal with the problem as it sees fit (ignore, throw exception); but if it does return, it has to skip the matching Json content parser has.
        Parameters:
        p - Parser that points to value of the unknown property
        ctxt - Context for deserialization; allows access to the parser, error reporting functionality
        instanceOrClass - Instance that is being populated by this deserializer, or if not known, Class that would be instantiated. If null, will assume type is what getValueClass() returns.
        propName - Name of the property that cannot be mapped
        Throws:
        java.io.IOException
      • handleMissingEndArrayForSingle

        protected void handleMissingEndArrayForSingle​(com.fasterxml.jackson.core.JsonParser p,
                                                      DeserializationContext ctxt)
                                               throws java.io.IOException
        Throws:
        java.io.IOException
      • _verifyEndArrayForSingle

        protected void _verifyEndArrayForSingle​(com.fasterxml.jackson.core.JsonParser p,
                                                DeserializationContext ctxt)
                                         throws java.io.IOException
        Throws:
        java.io.IOException
      • _neitherNull

        protected static final boolean _neitherNull​(java.lang.Object a,
                                                    java.lang.Object b)
        Since:
        2.9
      • _byteOverflow

        protected final boolean _byteOverflow​(int value)
        Since:
        2.9
      • _shortOverflow

        protected final boolean _shortOverflow​(int value)
        Since:
        2.9
      • _intOverflow

        protected final boolean _intOverflow​(long value)
        Since:
        2.9
      • _nonNullNumber

        protected java.lang.Number _nonNullNumber​(java.lang.Number n)
        Since:
        2.9