Code example for Gson

Methods: fromJson

    // METHODS 
    // ============================================================================================ 
    protected T deserializeData(String json) {
        return gson.fromJson(json, getHandledClass());
    protected void saveData(T data, Object cacheKey) throws IOException,
        CacheSavingException { 
        String resultJson;
        // transform the content in json to store it in the cache 
        resultJson = gson.toJson(data);
        // finally store the json in the cache 
        if (!StringUtils.isEmpty(resultJson)) {
            FileUtils.writeStringToFile(getCacheFile(cacheKey), resultJson,
        } else { 
Experience pair programming with AI  Get Codota for Java