Optional Type Adapter
Custom Gson TypeAdapter for handling Java Optional types during JSON serialization and deserialization.
This adapter properly handles the serialization of Optional values by writing null when the Optional is empty and the actual value when present. During deserialization, it reconstructs the Optional wrapper around the deserialized value or returns an empty Optional for null values.
Parameters
E
The type parameter for the Optional's contained value