|
1 | 1 | package io.api.etherscan.core.impl;
|
2 | 2 |
|
3 | | -import com.google.gson.Gson; |
| 3 | +import com.google.gson.*; |
4 | 4 | import io.api.etherscan.error.ApiException;
|
5 | 5 | import io.api.etherscan.error.EtherScanException;
|
6 | 6 | import io.api.etherscan.error.ParseException;
|
|
10 | 10 | import io.api.etherscan.model.utility.StringResponseTO;
|
11 | 11 | import io.api.etherscan.util.BasicUtils;
|
12 | 12 |
|
| 13 | +import java.time.LocalDate; |
| 14 | +import java.time.LocalDateTime; |
13 | 15 | import java.util.Map;
|
14 | 16 |
|
15 | 17 | /**
|
@@ -40,7 +42,12 @@ abstract class BasicProvider {
|
40 | 42 | this.module = "&module=" + module;
|
41 | 43 | this.baseUrl = baseUrl;
|
42 | 44 | this.executor = executor;
|
43 | | - this.gson = new Gson(); |
| 45 | + this.gson = new GsonBuilder() |
| 46 | + .registerTypeAdapter(LocalDateTime.class, (JsonSerializer<LocalDateTime>) (src, t, c) -> new JsonPrimitive("")) |
| 47 | + .registerTypeAdapter(LocalDate.class, (JsonSerializer<LocalDate>) (src, t, context) -> new JsonPrimitive("")) |
| 48 | + .registerTypeAdapter(LocalDateTime.class, (JsonDeserializer<LocalDateTime>) (json, t, c) -> null) |
| 49 | + .registerTypeAdapter(LocalDate.class, (JsonDeserializer<LocalDate>) (json, t, c) -> null) |
| 50 | + .create(); |
44 | 51 | }
|
45 | 52 |
|
46 | 53 | <T> T convert(final String json, final Class<T> tClass) {
|
|
0 commit comments