package com.davidmogar.quizzer.deserializers;

import com.davidmogar.quizzer.domain.Answer;
import com.davidmogar.quizzer.domain.Grade;
import com.davidmogar.quizzer.domain.questions.Question;
import com.google.gson.*;

import java.util.HashMap;
import java.util.List;

public class AssessmentDeserializer {

    @SuppressWarnings("unchecked")
    public static HashMap<Long, List<Answer>> deserializeAnswers(String json) {
        return deserialize(json, new AnswersDeserializer());
    }

    @SuppressWarnings("unchecked")
    public static HashMap<Long, Grade> deserializeGrades(String json) {
        return deserialize(json, new GradesDeserializer());
    }

    @SuppressWarnings("unchecked")
    public static HashMap<Long, Question> deserializeQuestions(String json) {
        return deserialize(json, new QuestionsDeserializer());
    }

    public static HashMap deserialize(String json, JsonDeserializer deserializer) {
        JsonParser parser = new JsonParser();
        JsonObject rootObject = parser.parse(json).getAsJsonObject();

        GsonBuilder gsonBuilder = new GsonBuilder();
        gsonBuilder.registerTypeAdapter(HashMap.class, deserializer);
        Gson gson = gsonBuilder.create();

        return gson.fromJson(rootObject, HashMap.class);
    }

}

@@ -406,35 +406,62 @@
 ers(String json)
+ throws JsonSyntaxException
  %7B%0A
-
         return d
@@ -608,32 +608,59 @@
 des(String json)
+ throws JsonSyntaxException
  %7B%0A        retur
@@ -823,16 +823,43 @@
 ng json)
+ throws JsonSyntaxException
  %7B%0A     
@@ -924,29 +924,30 @@
     %7D%0A%0A    p
-ublic
+rivate
  static Hash

Change deserialize method accessor