public final class MetadataTypeGsonTypeAdapter extends com.google.gson.TypeAdapter<MetadataType>
Gson TypeAdapter that helps to serialize and deserialize MetadataType objects.
To use it, register it into Gson use the GsonBuilder and invoking
GsonBuilder.registerTypeAdapter(Type type, Object typeAdapter), with MetadataType class as the
type parameter and an instance of MetadataTypeGsonTypeAdapter for the typeAdapter parameter.| Constructor and Description |
|---|
MetadataTypeGsonTypeAdapter()
Creates a new instance which serializes all types explicitly without
handling references
|
MetadataTypeGsonTypeAdapter(ObjectTypeReferenceHandler referenceHandler)
Creates a new instance which handles type references through the given
referenceHandler |
| Modifier and Type | Method and Description |
|---|---|
MetadataType |
read(com.google.gson.stream.JsonReader jsonReader)
Uses the
JsonReader containing the JSON representation of a MetadataType, it gets deserialized and
returns the instance. |
void |
write(com.google.gson.stream.JsonWriter jsonWriter,
MetadataType metadataType)
Given a
MetadataType as parameter, this serializes it, and writes the Json object using the |
public MetadataTypeGsonTypeAdapter()
public MetadataTypeGsonTypeAdapter(ObjectTypeReferenceHandler referenceHandler)
referenceHandlerreferenceHandler - an ObjectTypeReferenceHandlerpublic void write(com.google.gson.stream.JsonWriter jsonWriter,
MetadataType metadataType)
throws IOException
MetadataType as parameter, this serializes it, and writes the Json object using the write in class com.google.gson.TypeAdapter<MetadataType>jsonWriter - JsonWriter instance to write the serialized object into JsonmetadataType - MetadataType instance to serializeIOExceptionpublic MetadataType read(com.google.gson.stream.JsonReader jsonReader) throws IOException
JsonReader containing the JSON representation of a MetadataType, it gets deserialized and
returns the instance.read in class com.google.gson.TypeAdapter<MetadataType>jsonReader - which contains as root level the JSON representation of a MetadataTypeMetadataType instance that represents the deserialized value of the JSON object.IOExceptionCopyright © 2022 MuleSoft, Inc.. All rights reserved.