How to ReFactor the Design and improve the Extensibility of the Code

public class TyMbLabelManager {


    private static final String storageName = "TyMbStorage";
    public static final String studentLabelMb = "xsbqdm";
    public static final String teacherLabelMb = "jsbqdm";
    public static final String feedBackMb = "fklxdm";
    public static final String rechargeMethodMb = "czfsdm";

    private Map<String, String> studentLabelMap = new HashMap<>();
    private Map<String, String> teacherLabelMap = new HashMap<>();
    private Map<String, String> feedBackMap = new HashMap<>();
    private Map<String, String> rechargeMethodMap = new HashMap<>();

    private static Map<String, Map<String, String>> mbMap = new HashMap<>();

    private static TyMbLabelManager instance = null;

    private TyMbLabelManager() {
        mbMap.put(studentLabelMb, studentLabelMap);
        mbMap.put(teacherLabelMb, teacherLabelMap);
        mbMap.put(feedBackMb, feedBackMap);
        mbMap.put(rechargeMethodMb, rechargeMethodMap);
    }

    public static TyMbLabelManager getInstance() {
        if (instance == null) {
            synchronized (TyMbLabelManager.class) {
                instance = new TyMbLabelManager();
            }
        }
        return instance;
    }



    public void getMbLabel(final String code) {
        GetLabelMB.InParam inParam = new GetLabelMB.InParam();
        inParam.set_codeclass(code);
        GetLabelMB.execute(inParam, new GetLabelMB.ResultListener() {
            @Override
            public void onError(String s) {
                Logger.getLogger().e(":" + s);
            }

            @Override
            public void onSuccess(GetLabelMB.OutParam outParam) {
                if (outParam != null && TyMathConstant.SUCCESSFUL.equals(outParam.get_isSuccess())) {
                    saveMb(outParam.get_data(), code);
                    getMbInfo();
                }
            }
        });
    }

    private void saveMb(ArrayList<GetLabelMB.Data_sub> data, String codeMb) {
        Gson gson = GsonUtil.getInstance();
        ArrayList<GetLabelMB.Data_sub> codeList = new ArrayList<>();
        String[] codeArray = codeMb.split(",");
        for (int i = 0; i < codeArray.length; iPP) {
            String code = codeArray[i];
            codeList.clear();
            for (int j = 0; j < data.size(); jPP) {
                GetLabelMB.Data_sub mb = data.get(j);
                if (code.equalsIgnoreCase(mb.get_codeclass())) {
                    codeList.add(mb);
                }
            }
            SPStoreUtil.putString(storageName, code, gson.toJson(codeList));
        }
    }


    public void getMbInfo() {
        Gson gson = GsonUtil.getInstance();
        for (Map.Entry<String, Map<String, String>> entry : mbMap.entrySet()) {

            String json = SPStoreUtil.getString(storageName, entry.getKey());

            if (TextUtils.isEmpty(json)) {
                continue;
            }

            ArrayList<GetLabelMB.Data_sub> mbList = gson.fromJson(json,
                    new TypeToken<List<GetLabelMB.Data_sub>>(){}.getType());
            if (mbList == null || mbList.isEmpty()) {
                continue;
            }
            putMb(mbList, entry.getValue());
        }
    }

    private void putMb(ArrayList<GetLabelMB.Data_sub> studentLabelList, Map<String, String> mbMap) {
        mbMap.clear();
        if (studentLabelList != null) {
            for (int i = 0; i < studentLabelList.size(); iPP) {
                GetLabelMB.Data_sub mb = studentLabelList.get(i);
                mbMap.put(mb.get_key(), mb.get_value());
            }
        }
    }

    public String getStudentMbLabel(String key) {
        String value = "";
        if (TextUtils.isEmpty(key)) {
            return value;
        }
        value = studentLabelMap.get(key);
        return value;
    }

    public String getTeacherMbLabel(String key) {
        String value = "";
        if (TextUtils.isEmpty(key)) {
            return value;
        }
        value = teacherLabelMap.get(key);
        return value;
    }

    public String getFeedBackMb(String key) {
        String value = "";
        if (TextUtils.isEmpty(key)) {
            return value;
        }
        value = feedBackMap.get(key);
        return value;
    }

    public String getRechargeMethodMb(String key) {
        String value = "";
        if (TextUtils.isEmpty(key)) {
            return value;
        }
        value = rechargeMethodMap.get(key);
        return value;
    }

    public Map<String, String> getStudentLabelMap(){
        return studentLabelMap;
    }

    public Map<String, String> getTeacherLabelMap(){
        return teacherLabelMap;
    }

    public Map<String, String> getFeedBackMap() {
        return feedBackMap;
    }

    public Map<String, String> getRechargeMethodMap() {
        return rechargeMethodMap;
    }
}
Apr.03,2021

Code can be merged, methods can be reused, encapsulated

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b35e44-2bfd5.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b35e44-2bfd5.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?