2
2
3
3
import java .io .File ;
4
4
import java .io .IOException ;
5
+ import java .lang .reflect .Type ;
5
6
import java .nio .file .Files ;
6
7
8
+ import com .google .gson .*;
7
9
import org .glassfish .jersey .client .ClientProperties ;
8
10
import org .glassfish .jersey .client .JerseyClient ;
9
11
import org .glassfish .jersey .client .JerseyClientBuilder ;
22
24
import com .creatubbles .api .response .gallery .CreateUserGalleryResponse ;
23
25
import com .creatubbles .api .response .user .UserProfileResponse ;
24
26
import com .creatubbles .api .util .EndPoints ;
25
- import com .google .gson .Gson ;
26
- import com .google .gson .GsonBuilder ;
27
27
28
28
29
29
@ SuppressWarnings ("deprecation" )
@@ -39,6 +39,7 @@ public class CreatubblesAPI {
39
39
.registerTypeAdapter (GetCreationsResponse .class , new GetCreationsResponse ())
40
40
.registerTypeAdapter (CreateCreationResponse .class , new CreateCreationResponse ())
41
41
.registerTypeAdapter (CreationsUploadsResponse .class , new CreationsUploadsResponse ())
42
+ .registerTypeAdapter (String .class , new StringAdapter ())
42
43
.create ();
43
44
44
45
public final static JerseyClient CLIENT = JerseyClientBuilder
@@ -83,4 +84,14 @@ public static void main(String[] args) throws IOException {
83
84
System .out .println ("-Finish-" );
84
85
}
85
86
87
+ static class StringAdapter implements JsonDeserializer <String > {
88
+
89
+ public String deserialize (JsonElement json , Type typeOfT ,
90
+ JsonDeserializationContext context )
91
+ throws JsonParseException {
92
+ String asString = json .getAsJsonPrimitive ().getAsString ();
93
+ return asString != null && asString .isEmpty () ? null : asString ;
94
+ }
95
+ }
96
+
86
97
}
0 commit comments