Package Services.Dependencies
Class TypeEdgeAdaptor
java.lang.Object
Services.Dependencies.TypeEdgeAdaptor
- All Implemented Interfaces:
com.google.gson.JsonDeserializer<Edge>
Custom Gson deserializer for
Edge objects.
This class allows polymorphic deserialization of Edge subclasses
based on the "type" field present in the JSON representation. Supported types
include:
- "bodyjson" →
EdgeBodyJSON - "bodyue" →
EdgeBodyUE - "cookie" →
EdgeCookie - "header" →
EdgeHeader - "queryparam" →
EdgeQueryParam - "url" →
EdgeUrl
If an unknown type is encountered, a JsonParseException is thrown.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondeserialize(com.google.gson.JsonElement jsonElement, Type type, com.google.gson.JsonDeserializationContext jsonDeserializationContext) Deserializes a JSON element into the appropriateEdgesubclass based on its "type" field.
-
Constructor Details
-
TypeEdgeAdaptor
public TypeEdgeAdaptor()
-
-
Method Details
-
deserialize
public Edge deserialize(com.google.gson.JsonElement jsonElement, Type type, com.google.gson.JsonDeserializationContext jsonDeserializationContext) throws com.google.gson.JsonParseException Deserializes a JSON element into the appropriateEdgesubclass based on its "type" field.- Specified by:
deserializein interfacecom.google.gson.JsonDeserializer<Edge>- Parameters:
jsonElement- the JSON element to deserializetype- the type of the object to deserialize to (should beEdge)jsonDeserializationContext- the Gson context for deserialization- Returns:
- the deserialized
Edgesubclass instance - Throws:
com.google.gson.JsonParseException- if the "type" field is missing or unknown
-