Package org.apache.flink.formats.json
Class JsonDeserializationSchema<T>
- java.lang.Object
-
- org.apache.flink.api.common.serialization.AbstractDeserializationSchema<T>
-
- org.apache.flink.formats.json.JsonDeserializationSchema<T>
-
- All Implemented Interfaces:
Serializable
,DeserializationSchema<T>
,ResultTypeQueryable<T>
@PublicEvolving public class JsonDeserializationSchema<T> extends AbstractDeserializationSchema<T>
DeserializationSchema that deserializes a JSON String.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.flink.api.common.serialization.DeserializationSchema
DeserializationSchema.InitializationContext
-
-
Field Summary
Fields Modifier and Type Field Description protected org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.ObjectMapper
mapper
-
Constructor Summary
Constructors Constructor Description JsonDeserializationSchema(Class<T> clazz)
JsonDeserializationSchema(Class<T> clazz, SerializableSupplier<org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.ObjectMapper> mapperFactory)
JsonDeserializationSchema(TypeInformation<T> typeInformation)
JsonDeserializationSchema(TypeInformation<T> typeInformation, SerializableSupplier<org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.ObjectMapper> mapperFactory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description T
deserialize(byte[] message)
De-serializes the byte message.void
open(DeserializationSchema.InitializationContext context)
Initialization method for the schema.-
Methods inherited from class org.apache.flink.api.common.serialization.AbstractDeserializationSchema
getProducedType, isEndOfStream
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.flink.api.common.serialization.DeserializationSchema
deserialize
-
-
-
-
Constructor Detail
-
JsonDeserializationSchema
public JsonDeserializationSchema(TypeInformation<T> typeInformation)
-
JsonDeserializationSchema
public JsonDeserializationSchema(Class<T> clazz, SerializableSupplier<org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.ObjectMapper> mapperFactory)
-
JsonDeserializationSchema
public JsonDeserializationSchema(TypeInformation<T> typeInformation, SerializableSupplier<org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.ObjectMapper> mapperFactory)
-
-
Method Detail
-
open
public void open(DeserializationSchema.InitializationContext context)
Description copied from interface:DeserializationSchema
Initialization method for the schema. It is called before the actual working methodsDeserializationSchema.deserialize(byte[])
and thus suitable for one time setup work.The provided
DeserializationSchema.InitializationContext
can be used to access additional features such as e.g. registering user metrics.- Parameters:
context
- Contextual information that can be used during initialization.
-
deserialize
public T deserialize(byte[] message) throws IOException
Description copied from class:AbstractDeserializationSchema
De-serializes the byte message.- Specified by:
deserialize
in interfaceDeserializationSchema<T>
- Specified by:
deserialize
in classAbstractDeserializationSchema<T>
- Parameters:
message
- The message, as a byte array.- Returns:
- The de-serialized message as an object.
- Throws:
IOException
-
-