package com.gh.gamecenter.core.utils;


import android.text.TextUtils;

import androidx.annotation.Nullable;

public class ClassUtils {

    @Nullable
    public static Class<?> forName(String name) {
        if (TextUtils.isEmpty(name)) return null;

        if ("NewsActivity".equals(name)) {
            name = "NewsDetailActivity";
        } else if ("GameDetailsActivity".equals(name)) {
            name = "GameDetailActivity";
        }
        try {
            if (!name.contains("com.gh")) {
                return Class.forName("com.gh.gamecenter." + name);
            } else {
                return Class.forName(name);
            }
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
        return null;
    }

}
