- Added realracing3-community.apk (71.57 MB) - Removed 32-bit support (armeabi-v7a) - Only includes arm64-v8a libraries - Decompiled source code included - Added README-community.md with analysis
184 lines
6.2 KiB
Java
184 lines
6.2 KiB
Java
package com.glu.plugins.gluanalytics.util;
|
|
|
|
import android.text.TextUtils;
|
|
import androidx.annotation.NonNull;
|
|
import androidx.annotation.Nullable;
|
|
import csdk.gluads.Consts;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public class ConfigUtil {
|
|
public static Boolean getNullableBoolean(@Nullable Object obj, @NonNull String str, Boolean bool) {
|
|
Object object = getObject(obj, str, null);
|
|
if (object == null) {
|
|
return bool;
|
|
}
|
|
if (object instanceof Boolean) {
|
|
return Boolean.valueOf(((Boolean) object).booleanValue());
|
|
}
|
|
if (object instanceof String) {
|
|
String str2 = (String) object;
|
|
if (TextUtils.equals(str2, "true")) {
|
|
return Boolean.TRUE;
|
|
}
|
|
if (TextUtils.equals(str2, "false")) {
|
|
return Boolean.FALSE;
|
|
}
|
|
throw new IllegalArgumentException("Can't convert string to boolean value: " + str2 + Consts.STRING_PERIOD);
|
|
}
|
|
throw new IllegalArgumentException("Unsupported type for boolean value: " + object.getClass());
|
|
}
|
|
|
|
public static boolean getBoolean(@Nullable Object obj, @NonNull String str) {
|
|
return getBoolean(obj, str, false);
|
|
}
|
|
|
|
public static boolean getBoolean(@Nullable Object obj, @NonNull String str, boolean z) {
|
|
Object object = getObject(obj, str, null);
|
|
if (object == null) {
|
|
return z;
|
|
}
|
|
if (object instanceof Boolean) {
|
|
return ((Boolean) object).booleanValue();
|
|
}
|
|
if (object instanceof String) {
|
|
String str2 = (String) object;
|
|
if (TextUtils.equals(str2, "true")) {
|
|
return true;
|
|
}
|
|
if (TextUtils.equals(str2, "false")) {
|
|
return false;
|
|
}
|
|
throw new IllegalArgumentException("Can't convert string to boolean value: " + str2 + Consts.STRING_PERIOD);
|
|
}
|
|
throw new IllegalArgumentException("Unsupported type for boolean value: " + object.getClass());
|
|
}
|
|
|
|
public static Long getNullableLong(@Nullable Object obj, @NonNull String str, Long l) {
|
|
Object object = getObject(obj, str, null);
|
|
if (object == null) {
|
|
return l;
|
|
}
|
|
if (object instanceof Number) {
|
|
return Long.valueOf(((Number) object).longValue());
|
|
}
|
|
if (object instanceof String) {
|
|
return Long.valueOf(Long.parseLong((String) object));
|
|
}
|
|
throw new IllegalArgumentException("Unsupported type for long value: " + object.getClass());
|
|
}
|
|
|
|
public static long getLong(@Nullable Object obj, @NonNull String str) {
|
|
return getLong(obj, str, 0L);
|
|
}
|
|
|
|
public static long getLong(@Nullable Object obj, @NonNull String str, long j) {
|
|
Object object = getObject(obj, str, null);
|
|
if (object == null) {
|
|
return j;
|
|
}
|
|
if (object instanceof Number) {
|
|
return ((Number) object).longValue();
|
|
}
|
|
if (object instanceof String) {
|
|
return Long.parseLong((String) object);
|
|
}
|
|
throw new IllegalArgumentException("Unsupported type for long value: " + object.getClass());
|
|
}
|
|
|
|
public static double getDouble(@Nullable Object obj, @NonNull String str) {
|
|
return getDouble(obj, str, 0.0d);
|
|
}
|
|
|
|
public static double getDouble(@Nullable Object obj, @NonNull String str, double d) {
|
|
Object object = getObject(obj, str, null);
|
|
if (object == null) {
|
|
return d;
|
|
}
|
|
if (object instanceof Number) {
|
|
return ((Number) object).doubleValue();
|
|
}
|
|
if (object instanceof String) {
|
|
return Double.parseDouble((String) object);
|
|
}
|
|
throw new IllegalArgumentException("Unsupported type for double value: " + object.getClass());
|
|
}
|
|
|
|
@Nullable
|
|
public static String getString(@Nullable Object obj, @NonNull String str) {
|
|
return getString(obj, str, null);
|
|
}
|
|
|
|
@Nullable
|
|
public static String getString(@Nullable Object obj, @NonNull String str, @Nullable String str2) {
|
|
Object object = getObject(obj, str, null);
|
|
if (object == null) {
|
|
return str2;
|
|
}
|
|
if (object instanceof String) {
|
|
return (String) object;
|
|
}
|
|
if ((object instanceof Number) || (object instanceof Boolean)) {
|
|
return object.toString();
|
|
}
|
|
throw new IllegalArgumentException("Unsupported type for string value: " + object.getClass());
|
|
}
|
|
|
|
@Nullable
|
|
public static Map<String, Object> getMap(@Nullable Object obj, @NonNull String str) {
|
|
return getMap(obj, str, null);
|
|
}
|
|
|
|
@Nullable
|
|
public static Map<String, Object> getMap(@Nullable Object obj, @NonNull String str, @Nullable Map<String, Object> map) {
|
|
Object object = getObject(obj, str, null);
|
|
if (object == null) {
|
|
return map;
|
|
}
|
|
if (object instanceof Map) {
|
|
return (Map) object;
|
|
}
|
|
throw new IllegalArgumentException("Unsupported type for map value: " + object.getClass());
|
|
}
|
|
|
|
public static List<Object> getList(@Nullable Object obj, @NonNull String str) {
|
|
return getList(obj, str, null);
|
|
}
|
|
|
|
@Nullable
|
|
public static List<Object> getList(@Nullable Object obj, @NonNull String str, @Nullable List<Object> list) {
|
|
Object object = getObject(obj, str, null);
|
|
if (object == null) {
|
|
return list;
|
|
}
|
|
if (object instanceof List) {
|
|
return (List) object;
|
|
}
|
|
throw new IllegalArgumentException("Unsupported type for list value: " + object.getClass());
|
|
}
|
|
|
|
public static Object getObject(@Nullable Object obj, @NonNull String str) {
|
|
return getObject(obj, str, null);
|
|
}
|
|
|
|
@Nullable
|
|
public static Object getObject(@Nullable Object obj, @NonNull String str, @Nullable Object obj2) {
|
|
if (obj == null) {
|
|
return obj2;
|
|
}
|
|
for (String str2 : splitPath(str)) {
|
|
if (obj == null) {
|
|
return obj2;
|
|
}
|
|
obj = ((Map) obj).get(str2);
|
|
}
|
|
return obj;
|
|
}
|
|
|
|
@NonNull
|
|
private static String[] splitPath(@NonNull String str) {
|
|
return str.split("\\.");
|
|
}
|
|
}
|