Package Services.Dependencies
Class EdgeAdapterFactory
java.lang.Object
Services.Dependencies.EdgeAdapterFactory
- All Implemented Interfaces:
com.google.gson.TypeAdapterFactory
Custom Gson
TypeAdapterFactory to handle runtime conversion of Edge objects.
This factory creates a TypeAdapter that deserializes JSON into the correct
subclass of Edge based on the type property in the JSON:
bodyjson→EdgeBodyJSONbodyue→EdgeBodyUEcookie→EdgeCookieheader→EdgeHeaderqueryparam→EdgeQueryParamurl→EdgeUrl- default →
Edge
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
EdgeAdapterFactory
public EdgeAdapterFactory()
-
-
Method Details
-
create
public <T> com.google.gson.TypeAdapter<T> create(com.google.gson.Gson gson, com.google.gson.reflect.TypeToken<T> type) Creates a custom TypeAdapter forEdgeobjects.- Specified by:
createin interfacecom.google.gson.TypeAdapterFactory- Type Parameters:
T- generic type- Parameters:
gson- Gson instancetype- the type to be adapted- Returns:
- a TypeAdapter for
Edgeand its subclasses, ornullif not applicable
-