package tq;

import android.content.ContentValues;
import android.database.Cursor;
import java.lang.reflect.Type;
import rq.a;

/* loaded from: classes3.dex */
public class c implements rq.d {

    /* loaded from: classes3.dex */
    private static class a implements rq.c {

        /* renamed from: a, reason: collision with root package name */
        private final Class f36615a;

        /* renamed from: b, reason: collision with root package name */
        private final rq.a f36616b;

        public a(Class cls, rq.a aVar) {
            this.f36616b = aVar;
            this.f36615a = cls;
        }

        @Override // rq.c
        public void a(Object obj, String str, ContentValues contentValues) {
            contentValues.put(str, this.f36616b.c(obj));
        }

        @Override // rq.c
        public a.b b() {
            return a.b.INTEGER;
        }

        @Override // rq.c
        public Object c(Cursor cursor, int i10) {
            long j10 = cursor.getLong(i10);
            try {
                Object newInstance = this.f36615a.newInstance();
                this.f36616b.f(Long.valueOf(j10), newInstance);
                return newInstance;
            } catch (IllegalAccessException e10) {
                throw new RuntimeException(e10);
            } catch (InstantiationException e11) {
                throw new RuntimeException(e11);
            }
        }
    }

    @Override // rq.d
    public rq.c a(pq.b bVar, Type type) {
        if (!(type instanceof Class)) {
            return null;
        }
        Class cls = (Class) type;
        if (bVar.e(cls)) {
            return new a(cls, bVar.b(cls));
        }
        return null;
    }
}
