import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

public  static <T> T callStaticObjectMethod(Class<?> clazz, Class<T> returnType, String method, Class<?>[] parameterTypes,
Object... values)
throws NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
Method declaredMethod = clazz.getDeclaredMethod(method, parameterTypes);
declaredMethod.setAccessible(true);
return (T) declaredMethod.invoke(null, values);
}

 

private static final String PHONE_ENCRYPT_UTIL_CLASS = "com.miui.enterprise.PhoneEncryptUtil";
private static boolean isEncryptedNumber(String number) {
try {
Class phoneEncryptUtil = Class.forName(PHONE_ENCRYPT_UTIL_CLASS);
return callStaticObjectMethod(phoneEncryptUtil, boolean.class, "isEncryptedNumber",
new Class[]{String.class}, number);
} catch (Exception e) {
return false;
}
}

相关文章:

  • 2021-07-19
  • 2021-08-19
  • 2021-07-21
  • 2021-07-30
猜你喜欢
  • 2022-12-23
  • 2021-06-05
  • 2022-12-23
  • 2022-12-23
  • 2021-11-20
  • 2022-12-23
  • 2022-01-20
相关资源
相似解决方案