Package edu.sc.seis.TauP.gson
Class VelocityLayerSerializer
java.lang.Object
edu.sc.seis.TauP.gson.VelocityLayerSerializer
- All Implemented Interfaces:
com.google.gson.JsonDeserializer<VelocityLayer>,com.google.gson.JsonSerializer<VelocityLayer>
public class VelocityLayerSerializer
extends Object
implements com.google.gson.JsonSerializer<VelocityLayer>, com.google.gson.JsonDeserializer<VelocityLayer>
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondeserialize(com.google.gson.JsonElement jsonElement, Type type, com.google.gson.JsonDeserializationContext jsonDeserializationContext) com.google.gson.JsonElementserialize(VelocityLayer src, Type typeOfSrc, com.google.gson.JsonSerializationContext context) Gson invokes this call-back method during serialization when it encounters a field of the specified type.
-
Constructor Details
-
VelocityLayerSerializer
public VelocityLayerSerializer()
-
-
Method Details
-
serialize
public com.google.gson.JsonElement serialize(VelocityLayer src, Type typeOfSrc, com.google.gson.JsonSerializationContext context) Gson invokes this call-back method during serialization when it encounters a field of the specified type.In the implementation of this call-back method, you should consider invoking
JsonSerializationContext.serialize(Object, Type)method to create JsonElements for any non-trivial field of thesrcobject. However, you should never invoke it on thesrcobject itself since that will cause an infinite loop (Gson will call your call-back method again).- Specified by:
serializein interfacecom.google.gson.JsonSerializer<VelocityLayer>- Parameters:
src- the object that needs to be converted to Json.typeOfSrc- the actual type (fully genericized version) of the source object.context- the serialization context- Returns:
- a JsonElement corresponding to the specified object.
-
deserialize
public VelocityLayer deserialize(com.google.gson.JsonElement jsonElement, Type type, com.google.gson.JsonDeserializationContext jsonDeserializationContext) throws com.google.gson.JsonParseException - Specified by:
deserializein interfacecom.google.gson.JsonDeserializer<VelocityLayer>- Throws:
com.google.gson.JsonParseException
-