Class GsonConfigSerializer
java.lang.Object
enterprises.iwakura.modularbot.config.ConfigSerializer
enterprises.iwakura.modularbot.config.serializer.GsonConfigSerializer
Config serializer using Gson
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new GsonConfigSerializer with a default Gson instance, which pretty prints JSONGsonConfigSerializer(com.google.gson.Gson gson) Creates a new GsonConfigSerializer with the provided Gson instance -
Method Summary
-
Constructor Details
-
GsonConfigSerializer
public GsonConfigSerializer(com.google.gson.Gson gson) Creates a new GsonConfigSerializer with the provided Gson instance- Parameters:
gson- Gson instance to use for serialization and deserialization
-
GsonConfigSerializer
public GsonConfigSerializer()Creates a new GsonConfigSerializer with a default Gson instance, which pretty prints JSON
-
-
Method Details
-
serialize
Serializes object to string- Specified by:
serializein classConfigSerializer- Parameters:
obj- Object to serialize- Returns:
- Serialized string
-
deserialize
Deserializes string to object- Specified by:
deserializein classConfigSerializer- Type Parameters:
T- Type of object- Parameters:
data- Data to deserializeclazz- Class of object- Returns:
- Deserialized object
-