Package com.postman.collection.adapter
Class CollectionSerializer
java.lang.Object
com.postman.collection.adapter.CollectionSerializer
- All Implemented Interfaces:
com.google.gson.JsonSerializer<Collection>
public class CollectionSerializer
extends Object
implements com.google.gson.JsonSerializer<Collection>
Custom serializer for the collection element. JSON does not require a particular order in order to be valid. However, Postman always outputs collections in the same order.
This serializer replicates that order.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncom.google.gson.JsonElementserialize(Collection src, Type typeOfSrc, com.google.gson.JsonSerializationContext context)
-
Constructor Details
-
CollectionSerializer
public CollectionSerializer()
-
-
Method Details
-
serialize
public com.google.gson.JsonElement serialize(Collection src, Type typeOfSrc, com.google.gson.JsonSerializationContext context) - Specified by:
serializein interfacecom.google.gson.JsonSerializer<Collection>- Parameters:
src- The Collection passed in by GsontypeOfSrc- The Java Type of the object being parsedcontext- Serialization context passed in by Gson- Returns:
- JsonElement The resulting Json
-