package com.ss.android.ugc.aweme.net;

import X.9gN;
import com.bytedance.covode.number.Covode;
import com.google.gson.Gson;
import com.google.gson.b.a;
import com.google.gson.c.b;
import com.google.gson.c.c;
import com.google.gson.u;
import com.google.gson.v;
import com.ss.android.ugc.aweme.music.model.Music;

public class MusicTypeAdapterFactory implements v {
    static {
        Covode.recordClassIndex(94639);
    }

    public <T> u<T> create(Gson gson, a<T> aVar) {
        if (!Music.class.isAssignableFrom(aVar.rawType)) {
            return null;
        }
        final u<T> LIZ = gson.LIZ((v) this, aVar);
        return new u<T>() {
            static {
                Covode.recordClassIndex(94640);
            }

            public T read(com.google.gson.c.a aVar) {
                if (aVar.LJFF() == b.NULL) {
                    aVar.LJIIJ();
                    return null;
                }
                T t = (Music) LIZ.read(aVar);
                9gN.LIZ().LIZ(t.getOwnerId(), t.getSecUid());
                return t;
            }

            public void write(c cVar, T t) {
                if (t == null) {
                    cVar.LJFF();
                } else {
                    LIZ.write(cVar, t);
                }
            }
        };
    }
}
