package com.baidu.liantian.engine; import android.content.Context; import android.text.TextUtils; import java.lang.reflect.Constructor; import java.lang.reflect.Method; import java.util.HashMap; import java.util.Map; /* compiled from: EngineFactory */ public class b { private static final Map<Class<?>, Object> a = new HashMap(); private static b b; private Context c; private b(Context context) { this.c = context; a(); } public static b a(Context context) { if (b == null) { b = new b(context); } return b; } public Object a(String str) { try { return a(str, null, null); } catch (Throwable th) { a.a(th); return null; } } public Object a(String str, Class<?>[] clsArr, Object... objArr) { try { Object obj = null; boolean z = true; for (Class<?> cls : a.keySet()) { if (cls != null) { Object obj2 = a.get(cls); try { Method method = cls.getMethod(str, clsArr); if (method != null) { method.setAccessible(true); try { obj = method.invoke(obj2, objArr); if (obj != null && (((obj instanceof Boolean) || obj.getClass() == Boolean.TYPE) && !((Boolean) obj).booleanValue())) { z = false; } } catch (Throwable th) { a.a(th); } } } catch (Throwable th2) { a.a(th2); } } } if (obj != null) { return ((obj instanceof Boolean) || obj.getClass() == Boolean.TYPE) ? Boolean.valueOf(z) : obj; } return obj; } catch (Throwable th3) { a.a(th3); return null; } } private void a() { Class<?> b2; String a2 = a.a(this.c, "content.properties", "list", false); if (!TextUtils.isEmpty(a2)) { for (String str : a2.split(",")) { String a3 = a.a(this.c, "content.properties", str, false); if (!TextUtils.isEmpty(a3) && (b2 = b(a3)) != null) { Object obj = null; try { Constructor<?> declaredConstructor = b2.getDeclaredConstructor(Context.class); if (declaredConstructor != null) { declaredConstructor.setAccessible(true); obj = declaredConstructor.newInstance(this.c); } if (obj != null) { a.put(b2, obj); } } catch (Throwable th) { a.a(th); } } } } } private Class<?> b(String str) { try { return Class.forName(str); } catch (ClassNotFoundException e) { e.printStackTrace(); return null; } } }