Skip to content
This repository has been archived by the owner on May 14, 2020. It is now read-only.

Commit

Permalink
#14 Removed JSON processing class.
Browse files Browse the repository at this point in the history
  • Loading branch information
axelerod committed Oct 5, 2015
1 parent 767116c commit 49be09d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,13 @@
*/
package com.smartling.api.sdk;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.reflect.TypeToken;
import com.smartling.api.sdk.dto.ApiResponse;
import com.smartling.api.sdk.dto.ApiResponseWrapper;
import com.smartling.api.sdk.dto.Data;
import com.smartling.api.sdk.util.DateTypeAdapter;
import com.smartling.api.sdk.util.HttpUtils;

import org.apache.commons.lang3.CharEncoding;
Expand All @@ -30,6 +33,7 @@

import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.List;

import static com.smartling.api.sdk.file.FileApiParams.API_KEY;
Expand Down Expand Up @@ -200,6 +204,12 @@ protected String getApiResponseMessages(final ApiResponse<?> apiResponse)

protected <T extends Data> ApiResponse<T> parseApiResponse(final String response, final TypeToken<ApiResponseWrapper<T>> responseType)
{
return JsonReader.parseApiResponse(response, responseType);
final GsonBuilder builder = new GsonBuilder();
builder.registerTypeAdapter(Date.class, new DateTypeAdapter());

final Gson gson = builder.create();
final ApiResponseWrapper<T> responseWrapper = gson.fromJson(response, responseType.getType());

return responseWrapper.getResponse();
}
}
23 changes: 0 additions & 23 deletions api-sdk/src/main/java/com/smartling/api/sdk/JsonReader.java

This file was deleted.

0 comments on commit 49be09d

Please sign in to comment.