Class TransactionAdapter
java.lang.Object
edu.ntnu.idi.idatt.storage.util.TransactionAdapter
- All Implemented Interfaces:
com.google.gson.JsonDeserializer<Transaction>, com.google.gson.JsonSerializer<Transaction>
public class TransactionAdapter
extends Object
implements com.google.gson.JsonSerializer<Transaction>, com.google.gson.JsonDeserializer<Transaction>
Transaction adapter class.
Guides Gson serializer/deserializer how to handle abstract object types.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondeserialize(com.google.gson.JsonElement json, Type typeOfT, com.google.gson.JsonDeserializationContext context) Method for deserialization of Transactions.com.google.gson.JsonElementserialize(Transaction t, Type typeOfT, com.google.gson.JsonSerializationContext context) Method for serialization of Transactions.
-
Constructor Details
-
TransactionAdapter
public TransactionAdapter()
-
-
Method Details
-
serialize
public com.google.gson.JsonElement serialize(Transaction t, Type typeOfT, com.google.gson.JsonSerializationContext context) Method for serialization of Transactions.- Specified by:
serializein interfacecom.google.gson.JsonSerializer<Transaction>- Parameters:
t- - Current transaction.typeOfT- - Type of transaction.context- - Serialization information.
-
deserialize
public Transaction deserialize(com.google.gson.JsonElement json, Type typeOfT, com.google.gson.JsonDeserializationContext context) throws com.google.gson.JsonParseException Method for deserialization of Transactions.- Specified by:
deserializein interfacecom.google.gson.JsonDeserializer<Transaction>- Parameters:
json- - Current transaction json text.typeOfT- - type of transaction.context- - Deserialization information.- Throws:
com.google.gson.JsonParseException
-