- 28,932 files - Full Java source code - Smali files - Resources Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
45 lines
1.6 KiB
Java
45 lines
1.6 KiB
Java
package androidx.datastore.preferences.protobuf;
|
|
|
|
/* loaded from: classes.dex */
|
|
final class ExtensionRegistryFactory {
|
|
static final Class<?> EXTENSION_REGISTRY_CLASS = reflectExtensionRegistry();
|
|
static final String FULL_REGISTRY_CLASS_NAME = "androidx.datastore.preferences.protobuf.ExtensionRegistry";
|
|
|
|
public static Class<?> reflectExtensionRegistry() {
|
|
try {
|
|
return Class.forName(FULL_REGISTRY_CLASS_NAME);
|
|
} catch (ClassNotFoundException unused) {
|
|
return null;
|
|
}
|
|
}
|
|
|
|
public static ExtensionRegistryLite create() {
|
|
if (EXTENSION_REGISTRY_CLASS != null) {
|
|
try {
|
|
return invokeSubclassFactory("newInstance");
|
|
} catch (Exception unused) {
|
|
}
|
|
}
|
|
return new ExtensionRegistryLite();
|
|
}
|
|
|
|
public static ExtensionRegistryLite createEmpty() {
|
|
if (EXTENSION_REGISTRY_CLASS != null) {
|
|
try {
|
|
return invokeSubclassFactory("getEmptyRegistry");
|
|
} catch (Exception unused) {
|
|
}
|
|
}
|
|
return ExtensionRegistryLite.EMPTY_REGISTRY_LITE;
|
|
}
|
|
|
|
public static boolean isFullRegistry(ExtensionRegistryLite extensionRegistryLite) {
|
|
Class<?> cls = EXTENSION_REGISTRY_CLASS;
|
|
return cls != null && cls.isAssignableFrom(extensionRegistryLite.getClass());
|
|
}
|
|
|
|
private static final ExtensionRegistryLite invokeSubclassFactory(String str) throws Exception {
|
|
return (ExtensionRegistryLite) EXTENSION_REGISTRY_CLASS.getDeclaredMethod(str, new Class[0]).invoke(null, new Object[0]);
|
|
}
|
|
}
|