<commit_before>package lsh.ext.gson.adapters;

import java.lang.reflect.Type;
import javax.annotation.Nonnull;

import com.google.common.collect.Multimap;
import com.google.gson.Gson;
import com.google.gson.TypeAdapter;
import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import lsh.ext.gson.AbstractBoundTypeAdapterFactory;
import lsh.ext.gson.ParameterizedTypes;

/**
 * Represents a type adapter factory for {@link Multimap} from Google Guava.
 *
 * @author <NAME>
 * @see MultimapTypeAdapter
 * @since 0-SNAPSHOT
 */
public final class MultimapTypeAdapterFactory
		extends AbstractBoundTypeAdapterFactory<Multimap<String, Object>> {

	private static final TypeAdapterFactory multimapTypeAdapterFactory = new MultimapTypeAdapterFactory();

	private MultimapTypeAdapterFactory() {
	}

	/**
	 * @return An instance of {@link MultimapTypeAdapterFactory}.
	 */
	public static TypeAdapterFactory get() {
		return multimapTypeAdapterFactory;
	}

	@Override
	protected boolean isSupported(@Nonnull final TypeToken<?> typeToken) {
		return Multimap.class.isAssignableFrom(typeToken.getRawType());
	}

	@Nonnull
	@Override
	protected TypeAdapter<Multimap<String, Object>> createTypeAdapter(final Gson gson, @Nonnull final TypeToken<?> typeToken) {
		final Type type = typeToken.getType();
		final Type[][] typeArguments = ParameterizedTypes.getTypeArguments(type);
		final Type valueType = typeArguments[1][0];
		return MultimapTypeAdapter.get(gson, valueType);
	}

}<commit_msg>Multimap type adapter supports string keys only<commit_after>package lsh.ext.gson.adapters;

import java.lang.reflect.Type;
import javax.annotation.Nonnull;

import com.google.common.collect.Multimap;
import com.google.gson.Gson;
import com.google.gson.TypeAdapter;
import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import lsh.ext.gson.AbstractBoundTypeAdapterFactory;
import lsh.ext.gson.ParameterizedTypes;

/**
 * Represents a type adapter factory for {@link Multimap} from Google Guava.
 *
 * @author <NAME>
 * @see MultimapTypeAdapter
 * @since 0-SNAPSHOT
 */
public final class MultimapTypeAdapterFactory
		extends AbstractBoundTypeAdapterFactory<Multimap<String, Object>> {

	private static final TypeAdapterFactory multimapTypeAdapterFactory = new MultimapTypeAdapterFactory();

	private MultimapTypeAdapterFactory() {
	}

	/**
	 * @return An instance of {@link MultimapTypeAdapterFactory}.
	 */
	public static TypeAdapterFactory get() {
		return multimapTypeAdapterFactory;
	}

	@Override
	protected boolean isSupported(@Nonnull final TypeToken<?> typeToken) {
		final boolean isAssignable = Multimap.class.isAssignableFrom(typeToken.getRawType());
		if ( !isAssignable ) {
			return false;
		}
		final Type[][] typeArguments = ParameterizedTypes.getTypeArguments(typeToken.getType());
		final Type keyType = typeArguments[0][0];
		return String.class.equals(keyType);
	}

	@Nonnull
	@Override
	protected TypeAdapter<Multimap<String, Object>> createTypeAdapter(final Gson gson, @Nonnull final TypeToken<?> typeToken) {
		final Type[][] typeArguments = ParameterizedTypes.getTypeArguments(typeToken.getType());
		final Type valueType = typeArguments[1][0];
		return MultimapTypeAdapter.get(gson, valueType);
	}

}
{'fraction_non_alphanumeric': 0.10239117106069896, 'fraction_numerical': 0.002452483139178418, 'mean_word_length': 5.972222222222222, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, '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': '3956849', 'n_tokens_mistral': 1017, 'n_tokens_neox': 985, 'n_words': 220}