Package org.mule.metadata.persistence
Class BaseMetadataTypeGsonTypeAdapter
- java.lang.Object
-
- com.google.gson.TypeAdapter<MetadataType>
-
- org.mule.metadata.persistence.BaseMetadataTypeGsonTypeAdapter
-
- Direct Known Subclasses:
MetadataTypeGsonTypeAdapter,ReducedMetadataTypeGsonTypeAdapter
public abstract class BaseMetadataTypeGsonTypeAdapter extends com.google.gson.TypeAdapter<MetadataType>
BaseGsonTypeAdapterthat helps to serialize and deserializeMetadataTypeobjects.TypeAdapterimplementation is done in this base class, concrete implementations should provide aMetadataTypeWriterand aSerializedMetadataTypeLoaderimplementations that actually know how to serialize/deserialize theMetadataTypein some JSON structure.- Since:
- 1.2.0, 1.1.7
-
-
Constructor Summary
Constructors Constructor Description BaseMetadataTypeGsonTypeAdapter(MetadataTypeWriter writer, SerializedMetadataTypeLoader loader)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MetadataTyperead(com.google.gson.stream.JsonReader jsonReader)Uses theJsonReadercontaining the JSON representation of aMetadataType, it gets deserialized and returns the instance.voidsetAllowNullInput(boolean allowNullInput)voidwrite(com.google.gson.stream.JsonWriter jsonWriter, MetadataType metadataType)Given aMetadataTypeas parameter, this serializes it, and writes the Json object using the {@param jsonWriter}
-
-
-
Constructor Detail
-
BaseMetadataTypeGsonTypeAdapter
public BaseMetadataTypeGsonTypeAdapter(MetadataTypeWriter writer, SerializedMetadataTypeLoader loader)
-
-
Method Detail
-
write
public void write(com.google.gson.stream.JsonWriter jsonWriter, MetadataType metadataType) throws IOExceptionGiven aMetadataTypeas parameter, this serializes it, and writes the Json object using the {@param jsonWriter}- Specified by:
writein classcom.google.gson.TypeAdapter<MetadataType>- Parameters:
jsonWriter-JsonWriterinstance to write the serialized object into JsonmetadataType-MetadataTypeinstance to doSerialize- Throws:
IOException
-
read
public MetadataType read(com.google.gson.stream.JsonReader jsonReader) throws IOException
Uses theJsonReadercontaining the JSON representation of aMetadataType, it gets deserialized and returns the instance.- Specified by:
readin classcom.google.gson.TypeAdapter<MetadataType>- Parameters:
jsonReader- which contains as root level the JSON representation of aMetadataType- Returns:
- a
MetadataTypeinstance that represents the deserialized value of the JSON object. - Throws:
IOException
-
setAllowNullInput
public void setAllowNullInput(boolean allowNullInput)
-
-