Class BaseDeserializer<T>
- java.lang.Object
-
- com.fasterxml.jackson.databind.JsonDeserializer<T>
-
- com.fasterxml.jackson.databind.deser.std.StdDeserializer<T>
-
- com.amazonaws.athena.connector.lambda.serde.BaseDeserializer<T>
-
- All Implemented Interfaces:
VersionedSerDe.Deserializer<T>
,com.fasterxml.jackson.databind.deser.NullValueProvider
,com.fasterxml.jackson.databind.deser.ValueInstantiator.Gettable
,Serializable
- Direct Known Subclasses:
BlockSerDe.Deserializer
,BlockSerDeV3.Deserializer
,BlockSerDeV4.Deserializer
,ConstraintsSerDe.Deserializer
,ConstraintsSerDeV4.Deserializer
,ConstraintsSerDeV5.Deserializer
,DelegatingDeserializer
,EncryptionKeySerDe.Deserializer
,FederatedIdentitySerDe.Deserializer
,FunctionNameSerDeV4.Deserializer
,LambdaFunctionExceptionSerDe.Deserializer
,MarkerSerDe.Deserializer
,OptimizationSubTypeSerDeV4.Deserializer
,OrderByFieldSerDeV4.Deserializer
,RangeSerDe.Deserializer
,SchemaSerDe.Deserializer
,SchemaSerDeV3.Deserializer
,SchemaSerDeV4.Deserializer
,SplitSerDe.Deserializer
,TableNameSerDe.Deserializer
,TypedDeserializer
public abstract class BaseDeserializer<T> extends com.fasterxml.jackson.databind.deser.std.StdDeserializer<T> implements VersionedSerDe.Deserializer<T>
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
BaseDeserializer(Class<T> clazz)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
assertFieldName(com.fasterxml.jackson.core.JsonParser jparser, String expectedFieldName)
Helper used to validate an expected field name.T
deserialize(com.fasterxml.jackson.core.JsonParser jparser, com.fasterxml.jackson.databind.DeserializationContext ctxt)
Object
deserializeWithType(com.fasterxml.jackson.core.JsonParser jp, com.fasterxml.jackson.databind.DeserializationContext ctxt, com.fasterxml.jackson.databind.jsontype.TypeDeserializer typeDeserializer)
abstract T
doDeserialize(com.fasterxml.jackson.core.JsonParser jparser, com.fasterxml.jackson.databind.DeserializationContext ctxt)
protected byte[]
getNextBinaryField(com.fasterxml.jackson.core.JsonParser jparser, String expectedFieldName)
Helper used to extract named byte array fields from the json parser in a streaming fashion.protected boolean
getNextBoolField(com.fasterxml.jackson.core.JsonParser jparser, String expectedFieldName)
Helper used to extract named boolean fields from the json parser in a streaming fashion.protected int
getNextIntField(com.fasterxml.jackson.core.JsonParser jparser, String expectedFieldName)
Helper used to extract named integer fields from the json parser in a streaming fashion.protected long
getNextLongField(com.fasterxml.jackson.core.JsonParser jparser, String expectedFieldName)
Helper used to extract named long fields from the json parser in a streaming fashion.protected List<String>
getNextStringArray(com.fasterxml.jackson.core.JsonParser jparser, String expectedFieldName)
Helper used to read a list of strings.protected String
getNextStringField(com.fasterxml.jackson.core.JsonParser jparser, String expectedFieldName)
Helper used to extract named String fields from the json parser in a streaming fashion.protected Map<String,String>
getNextStringMap(com.fasterxml.jackson.core.JsonParser jparser, String expectedFieldName)
Helper used to read a Map of strings to strings.protected String
getType(com.fasterxml.jackson.core.JsonParser jparser)
Helper used to parse the type of the object (usually the class name).protected void
ignoreRestOfObject(com.fasterxml.jackson.core.JsonParser jparser)
Helper used to skip to the end of the current object.protected void
validateArrayStart(com.fasterxml.jackson.core.JsonParser jparser)
Helper used to validate that an array is starting (open bracket) at the next token.protected void
validateObjectEnd(com.fasterxml.jackson.core.JsonParser jparser)
Helper used to validate that an object is ending (close brace) at the next token.protected void
validateObjectStart(com.fasterxml.jackson.core.JsonParser jparser)
Helper used to validate that an object is starting (open brace) at the next token.protected void
validateObjectStart(com.fasterxml.jackson.core.JsonToken token)
Helper used to validate that an object is starting (open brace) at the providedJsonToken
.protected void
writeStringArray(com.fasterxml.jackson.core.JsonGenerator jgen, String fieldname, Collection<String> values)
Helper used to help serialize a list of strings.-
Methods inherited from class com.fasterxml.jackson.databind.deser.std.StdDeserializer
_byteOverflow, _checkBooleanToStringCoercion, _checkCoercionFail, _checkDoubleSpecialValue, _checkFloatSpecialValue, _checkFloatToIntCoercion, _checkFloatToStringCoercion, _checkFromStringCoercion, _checkFromStringCoercion, _checkIntToFloatCoercion, _checkIntToStringCoercion, _checkTextualNull, _checkToStringCoercion, _coerceBooleanFromInt, _coercedTypeDesc, _coercedTypeDesc, _coerceEmptyString, _coerceIntegral, _coerceNullToken, _coerceTextualNull, _deserializeFromArray, _deserializeFromEmpty, _deserializeFromEmptyString, _deserializeFromString, _deserializeWrappedValue, _failDoubleToIntCoercion, _findCoercionFromBlankString, _findCoercionFromEmptyArray, _findCoercionFromEmptyString, _findNullProvider, _hasTextualNull, _intOverflow, _isBlank, _isEmptyOrTextualNull, _isFalse, _isIntNumber, _isNaN, _isNegInf, _isPosInf, _isTrue, _neitherNull, _nonNullNumber, _parseBoolean, _parseBooleanFromInt, _parseBooleanPrimitive, _parseBooleanPrimitive, _parseBytePrimitive, _parseDate, _parseDate, _parseDateFromArray, _parseDouble, _parseDouble, _parseDoublePrimitive, _parseDoublePrimitive, _parseDoublePrimitive, _parseFloatPrimitive, _parseFloatPrimitive, _parseFloatPrimitive, _parseInteger, _parseInteger, _parseIntPrimitive, _parseIntPrimitive, _parseLong, _parseLong, _parseLongPrimitive, _parseLongPrimitive, _parseShortPrimitive, _parseString, _parseString, _reportFailedNullCoerce, _shortOverflow, _verifyEndArrayForSingle, _verifyNullForPrimitive, _verifyNullForPrimitiveCoercion, _verifyNullForScalarCoercion, _verifyNumberForScalarCoercion, _verifyStringForScalarCoercion, findContentNullProvider, findContentNullStyle, findConvertingContentDeserializer, findDeserializer, findFormatFeature, findFormatOverrides, findValueNullProvider, getValueClass, getValueInstantiator, getValueType, getValueType, handledType, handleMissingEndArrayForSingle, handleNestedArrayForSingle, handleUnknownProperty, isDefaultDeserializer, isDefaultKeyDeserializer
-
Methods inherited from class com.fasterxml.jackson.databind.JsonDeserializer
deserialize, deserializeWithType, findBackReference, getAbsentValue, getDelegatee, getEmptyAccessPattern, getEmptyValue, getEmptyValue, getKnownPropertyNames, getNullAccessPattern, getNullValue, getNullValue, getObjectIdReader, isCachable, logicalType, replaceDelegatee, supportsUpdate, unwrappingDeserializer
-
-
-
-
Method Detail
-
deserialize
public T deserialize(com.fasterxml.jackson.core.JsonParser jparser, com.fasterxml.jackson.databind.DeserializationContext ctxt) throws IOException
- Specified by:
deserialize
in interfaceVersionedSerDe.Deserializer<T>
- Specified by:
deserialize
in classcom.fasterxml.jackson.databind.JsonDeserializer<T>
- Throws:
IOException
-
deserializeWithType
public Object deserializeWithType(com.fasterxml.jackson.core.JsonParser jp, com.fasterxml.jackson.databind.DeserializationContext ctxt, com.fasterxml.jackson.databind.jsontype.TypeDeserializer typeDeserializer) throws IOException
- Overrides:
deserializeWithType
in classcom.fasterxml.jackson.databind.deser.std.StdDeserializer<T>
- Throws:
IOException
-
doDeserialize
public abstract T doDeserialize(com.fasterxml.jackson.core.JsonParser jparser, com.fasterxml.jackson.databind.DeserializationContext ctxt) throws IOException
- Specified by:
doDeserialize
in interfaceVersionedSerDe.Deserializer<T>
- Throws:
IOException
-
getNextStringField
protected String getNextStringField(com.fasterxml.jackson.core.JsonParser jparser, String expectedFieldName) throws IOException
Helper used to extract named String fields from the json parser in a streaming fashion.- Parameters:
jparser
- The parser to use for extraction.expectedFieldName
- The expected name of the next field in the stream.- Returns:
- The string representation of the requested field.
- Throws:
IOException
- If there is an error parsing the field.
-
getNextBoolField
protected boolean getNextBoolField(com.fasterxml.jackson.core.JsonParser jparser, String expectedFieldName) throws IOException
Helper used to extract named boolean fields from the json parser in a streaming fashion.- Parameters:
jparser
- The parser to use for extraction.expectedFieldName
- The expected name of the next field in the stream.- Returns:
- The boolean representation of the requested field.
- Throws:
IOException
- If there is an error parsing the field.
-
getNextBinaryField
protected byte[] getNextBinaryField(com.fasterxml.jackson.core.JsonParser jparser, String expectedFieldName) throws IOException
Helper used to extract named byte array fields from the json parser in a streaming fashion.- Parameters:
jparser
- The parser to use for extraction.expectedFieldName
- The expected name of the next field in the stream.- Returns:
- The byte array representation of the requested field.
- Throws:
IOException
- If there is an error parsing the field.
-
getNextIntField
protected int getNextIntField(com.fasterxml.jackson.core.JsonParser jparser, String expectedFieldName) throws IOException
Helper used to extract named integer fields from the json parser in a streaming fashion.- Parameters:
jparser
- The parser to use for extraction.expectedFieldName
- The expected name of the next field in the stream.- Returns:
- The integer representation of the requested field.
- Throws:
IOException
- If there is an error parsing the field.
-
getNextLongField
protected long getNextLongField(com.fasterxml.jackson.core.JsonParser jparser, String expectedFieldName) throws IOException
Helper used to extract named long fields from the json parser in a streaming fashion.- Parameters:
jparser
- The parser to use for extraction.expectedFieldName
- The expected name of the next field in the stream.- Returns:
- The integer representation of the requested field.
- Throws:
IOException
- If there is an error parsing the field.
-
writeStringArray
protected void writeStringArray(com.fasterxml.jackson.core.JsonGenerator jgen, String fieldname, Collection<String> values) throws IOException
Helper used to help serialize a list of strings.- Parameters:
jgen
- The json generator to use.fieldname
- The name to associated to the resulting json array.values
- The values to populate the array with.- Throws:
IOException
- If an error occurs while writing to the generator.
-
getNextStringArray
protected List<String> getNextStringArray(com.fasterxml.jackson.core.JsonParser jparser, String expectedFieldName) throws IOException
Helper used to read a list of strings.- Parameters:
jparser
- The parser to read from.expectedFieldName
- The expected name of the field containing the string array.- Returns:
- The contents of the array as a list.
- Throws:
IOException
- If an error occurs while reading from the parser.
-
getNextStringMap
protected Map<String,String> getNextStringMap(com.fasterxml.jackson.core.JsonParser jparser, String expectedFieldName) throws IOException
Helper used to read a Map of strings to strings.- Parameters:
jparser
- The parser to read from.expectedFieldName
- The expected name of the field containing the string map.- Returns:
- The contents of the array as a map.
- Throws:
IOException
- If an error occurs while reading from the parser.
-
assertFieldName
protected void assertFieldName(com.fasterxml.jackson.core.JsonParser jparser, String expectedFieldName) throws IOException
Helper used to validate an expected field name.- Parameters:
jparser
- The parser to read from.expectedFieldName
- The expected name of the next field.- Throws:
IOException
- If an error occurs while reading from the parser.
-
validateObjectStart
protected void validateObjectStart(com.fasterxml.jackson.core.JsonToken token) throws IOException
Helper used to validate that an object is starting (open brace) at the providedJsonToken
.- Parameters:
token
- The token expected to be an object start.- Throws:
IOException
- If an error occurs while reading from the parser.
-
validateObjectEnd
protected void validateObjectEnd(com.fasterxml.jackson.core.JsonParser jparser) throws IOException
Helper used to validate that an object is ending (close brace) at the next token.- Parameters:
jparser
- The parser to read from.- Throws:
IOException
- If an error occurs while reading from the parser.
-
validateArrayStart
protected void validateArrayStart(com.fasterxml.jackson.core.JsonParser jparser) throws IOException
Helper used to validate that an array is starting (open bracket) at the next token.- Parameters:
jparser
- The parser to read from.- Throws:
IOException
- If an error occurs while reading from the parser.
-
validateObjectStart
protected void validateObjectStart(com.fasterxml.jackson.core.JsonParser jparser) throws IOException
Helper used to validate that an object is starting (open brace) at the next token.- Parameters:
jparser
- The parser to read from.- Throws:
IOException
- If an error occurs while reading from the parser.
-
getType
protected String getType(com.fasterxml.jackson.core.JsonParser jparser) throws IOException
Helper used to parse the type of the object (usually the class name).- Parameters:
jparser
- The parser to use for extraction.- Returns:
- The type name of the object being deserialized.
- Throws:
IOException
- If there is an error parsing the field.
-
ignoreRestOfObject
protected void ignoreRestOfObject(com.fasterxml.jackson.core.JsonParser jparser) throws IOException
Helper used to skip to the end of the current object. Useful for forwards compatibility.- Parameters:
jparser
- The parser to use for extraction.- Throws:
IOException
- If there is an error parsing.
-
-