File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed
firebase-auth-rest/core/src/main/java/com/anotherdev/firebase/auth/data Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change 1+ package com .anotherdev .firebase .auth .data ;
2+
3+ import androidx .annotation .NonNull ;
4+
5+ import com .anotherdev .firebase .auth .util .FarGson ;
6+ import com .f2prateek .rx .preferences2 .Preference ;
7+ import com .google .gson .Gson ;
8+
9+ class RxPreferenceGsonConverter <T > implements Preference .Converter <T > {
10+
11+ private final Gson GSON = FarGson .get ();
12+ private final Class <T > valueType ;
13+
14+
15+ RxPreferenceGsonConverter (Class <T > valueType ) {
16+ this .valueType = valueType ;
17+ }
18+
19+ @ NonNull
20+ @ Override
21+ public T deserialize (@ NonNull String json ) {
22+ return GSON .fromJson (json , valueType );
23+ }
24+
25+ @ NonNull
26+ @ Override
27+ public String serialize (@ NonNull T value ) {
28+ return GSON .toJson (value );
29+ }
30+ }
You can’t perform that action at this time.
0 commit comments