serialize enum fields with gson

By default, Gson just serialize the ‘name’ of the Enum which might not be enough since we might need also want to carry all the fields during the serialization. To achieve this we need to has our own gson adaptor and make use of reflection. usage: Enum class: Test Code: Result:

ignore field when serialize/deserialize with Gson

While we use Gson for serializing/deserializing, some field we might want to ignore. A direct way is to make the field transient. Alternatively we could use the @Expose to annotate the field we want to be handled. However there is currently no way to ignore in one way. Here is a solution