Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gson avoid reflection

Is there a way to avoid reflection in Gson? I know that when you will use registerTypeAdapter you can avoid it, but if you use @SerializedName("name") annotation on class member, can you avoid id too?

like image 886
Szymon Haxik Avatar asked Sep 06 '25 03:09

Szymon Haxik


1 Answers

You can use Autovalue and Autovalue-gson that will create a reflection free adapter for you.

like image 91
mbonnin Avatar answered Sep 07 '25 21:09

mbonnin