package androidx.room; import android.content.Context; import androidx.room.h; /* loaded from: classes.dex */ public abstract class g { public static h.a a(Context context, Class cls, String str) { if (str == null || str.trim().length() == 0) { throw new IllegalArgumentException("Cannot build a database with null or empty name. If you are trying to create an in memory database, use Room.inMemoryDatabaseBuilder"); } return new h.a(context, cls, str); } static Object b(Class cls, String str) { String str2; String name = cls.getPackage().getName(); String canonicalName = cls.getCanonicalName(); if (!name.isEmpty()) { canonicalName = canonicalName.substring(name.length() + 1); } String str3 = canonicalName.replace('.', '_') + str; try { if (name.isEmpty()) { str2 = str3; } else { str2 = name + "." + str3; } return Class.forName(str2).newInstance(); } catch (ClassNotFoundException unused) { throw new RuntimeException("cannot find implementation for " + cls.getCanonicalName() + ". " + str3 + " does not exist"); } catch (IllegalAccessException unused2) { throw new RuntimeException("Cannot access the constructor" + cls.getCanonicalName()); } catch (InstantiationException unused3) { throw new RuntimeException("Failed to create an instance of " + cls.getCanonicalName()); } } public static h.a c(Context context, Class cls) { return new h.a(context, cls, null); } }