package com.amplifyframework.api.aws;

import com.amplifyframework.api.graphql.GsonResponseAdapters;
import com.amplifyframework.core.model.query.predicate.GsonPredicateAdapters;
import com.amplifyframework.core.model.temporal.GsonTemporalAdapters;
import com.amplifyframework.core.model.types.GsonJavaTypeAdapters;
import com.amplifyframework.datastore.appsync.ModelWithMetadataAdapter;
import com.amplifyframework.datastore.appsync.SerializedCustomTypeAdapter;
import com.amplifyframework.datastore.appsync.SerializedModelAdapter;

/* loaded from: classes4.dex */
final class GsonFactory {
    private static com.google.gson.d gson;

    private GsonFactory() {
    }

    private static com.google.gson.d create() {
        com.google.gson.e eVar = new com.google.gson.e();
        GsonTemporalAdapters.register(eVar);
        GsonJavaTypeAdapters.register(eVar);
        GsonPredicateAdapters.register(eVar);
        GsonResponseAdapters.register(eVar);
        ModelWithMetadataAdapter.register(eVar);
        SerializedModelAdapter.register(eVar);
        SerializedCustomTypeAdapter.register(eVar);
        ModelListDeserializer.register(eVar);
        ModelPageDeserializer.register(eVar);
        eVar.f();
        return eVar.b();
    }

    public static synchronized com.google.gson.d instance() {
        com.google.gson.d dVar;
        synchronized (GsonFactory.class) {
            if (gson == null) {
                gson = create();
            }
            dVar = gson;
        }
        return dVar;
    }
}
