Fix su serializzatore GSON
This commit is contained in:
parent
377950c978
commit
a1b3517b07
@ -22,6 +22,7 @@ import javax.inject.Singleton;
|
||||
import it.integry.integrywmsnative.core.CommonConst;
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
import it.integry.integrywmsnative.core.rest.model.OrdineUscitaInevasoDTO;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityGson;
|
||||
|
||||
@Singleton
|
||||
public class ColliDataRecoverService {
|
||||
@ -108,7 +109,7 @@ public class ColliDataRecoverService {
|
||||
|
||||
private void loadLocalFile() {
|
||||
InputStream inputStream;
|
||||
Gson gson = new Gson();
|
||||
Gson gson = UtilityGson.createObject();
|
||||
|
||||
try {
|
||||
inputStream = mApplicationContext.openFileInput(CommonConst.Files.RECOVER_COLLO_FILE);
|
||||
@ -130,7 +131,7 @@ public class ColliDataRecoverService {
|
||||
private void updateLocalFile() {
|
||||
FileOutputStream outputStream;
|
||||
|
||||
Gson gson = new Gson();
|
||||
Gson gson = UtilityGson.createObject();
|
||||
String jsonText = gson.toJson(mtbColtsSessions);
|
||||
|
||||
try {
|
||||
|
||||
@ -40,7 +40,7 @@ public class EntityRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
if (response.body() != null) {
|
||||
if (response.body().getEsito() == EsitoType.OK) {
|
||||
Gson gson = new Gson();
|
||||
Gson gson = UtilityGson.createObject();
|
||||
T object = gson.fromJson(response.body().getEntity(), type);
|
||||
|
||||
callback.onSuccess(object);
|
||||
@ -133,7 +133,7 @@ public class EntityRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
if (response.body() != null) {
|
||||
if (response.body().getEsito() == EsitoType.OK) {
|
||||
Gson gson = new Gson();
|
||||
Gson gson = UtilityGson.createObject();
|
||||
List<JsonObject> jsons = response.body().getEntityList();
|
||||
|
||||
List<T> newList = new ArrayList<T>();
|
||||
|
||||
@ -32,6 +32,7 @@ import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||
import it.integry.integrywmsnative.core.rest.model.system.RegisterDeviceRequestDTO;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityGson;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
@ -72,15 +73,7 @@ public class SystemRESTConsumer extends _BaseRESTConsumer {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<Object>> call, Response<ServiceRESTResponse<Object>> response) {
|
||||
analyzeAnswer(response, "ProcessSql", o -> {
|
||||
Gson gson = new GsonBuilder()
|
||||
.registerTypeAdapter(Date.class, (JsonDeserializer<?>) (json, typeOfT, context) -> {
|
||||
try {
|
||||
return UtilityDate.recognizeDate(json.getAsString());
|
||||
} catch (Exception e) {
|
||||
throw new JsonParseException(e);
|
||||
}
|
||||
})
|
||||
.create();
|
||||
Gson gson = UtilityGson.createObject();
|
||||
|
||||
|
||||
String json = gson.toJson(o);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user