<commit_before>package com.monits.agilefant.module;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.monits.agilefant.model.UserChooser;
import com.monits.agilefant.parse.adapter.UserChooserDeserializer;

import javax.inject.Singleton;

import dagger.Module;
import dagger.Provides;

@Module
public class GsonModule {

	@Provides
	@Singleton
	Gson provideGson() {
		final GsonBuilder gsonBuilder = new GsonBuilder();
		gsonBuilder.registerTypeAdapter(UserChooser.class, new UserChooserDeserializer());
		return gsonBuilder.create();
	}
}<commit_msg>Json Deserializer for Product, Projet and Iteration<commit_after>package com.monits.agilefant.module;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement;
import com.google.gson.JsonParseException;
import com.monits.agilefant.model.Backlog;
import com.monits.agilefant.model.Iteration;
import com.monits.agilefant.model.Product;
import com.monits.agilefant.model.Project;
import com.monits.agilefant.model.UserChooser;
import com.monits.agilefant.parse.adapter.UserChooserDeserializer;

import java.lang.reflect.Type;

import javax.inject.Singleton;

import dagger.Module;
import dagger.Provides;

@Module
public class GsonModule {

	@Provides
	@Singleton
	Gson provideGson() {
		final GsonBuilder gsonBuilder = new GsonBuilder();
		gsonBuilder.registerTypeAdapter(UserChooser.class, new UserChooserDeserializer());
		gsonBuilder.registerTypeAdapter(Backlog.class, new JsonDeserializer<Backlog>() {

			@Override
			public Backlog deserialize(final JsonElement json, final Type typeOfT,
									final JsonDeserializationContext context) throws JsonParseException {
				final String classType = json.getAsJsonObject().get("class").getAsString();

				if (classType.endsWith("Product")) {
					return context.deserialize(json, Product.class);
				} else if (classType.endsWith("Iteration")) {
					return context.deserialize(json, Iteration.class);
				} else if (classType.endsWith("Project")) {
					return context.deserialize(json, Project.class);
				}

				throw new AssertionError("trying to decode a backlog from " + json.getAsString());
			}
		});

		return gsonBuilder.create();
	}
}
{'fraction_non_alphanumeric': 0.10524036379385016, 'fraction_numerical': 0.0, 'mean_word_length': 5.543909348441926, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5833716', 'n_tokens_mistral': 805, 'n_tokens_neox': 726, 'n_words': 139}