Rabbit-R1/android (non root)/java/sources/com/google/common/reflect/Reflection.java
2024-05-21 17:08:36 -04:00

37 lines
1.2 KiB
Java

package com.google.common.reflect;
import com.google.common.base.Preconditions;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Proxy;
@ElementTypesAreNonnullByDefault
/* loaded from: classes3.dex */
public final class Reflection {
public static String getPackageName(Class<?> cls) {
return getPackageName(cls.getName());
}
public static String getPackageName(String str) {
int lastIndexOf = str.lastIndexOf(46);
return lastIndexOf < 0 ? "" : str.substring(0, lastIndexOf);
}
public static void initialize(Class<?>... clsArr) {
for (Class<?> cls : clsArr) {
try {
Class.forName(cls.getName(), true, cls.getClassLoader());
} catch (ClassNotFoundException e) {
throw new AssertionError(e);
}
}
}
public static <T> T newProxy(Class<T> cls, InvocationHandler invocationHandler) {
Preconditions.checkNotNull(invocationHandler);
Preconditions.checkArgument(cls.isInterface(), "%s is not an interface", cls);
return cls.cast(Proxy.newProxyInstance(cls.getClassLoader(), new Class[]{cls}, invocationHandler));
}
private Reflection() {
}
}