package com.imdroid.common.util;

public class ObjUtil {
    public static String compare(Object obj1, Object obj2){
        if(!obj1.getClass().equals(obj2.getClass())) return "";

        String[] items = obj1.toString().replaceAll(" +","").split(",|:");
        String[] items2 = obj2.toString().replaceAll(" +","").split(",|:");

        String diff = "";
        for(int i=0; i<items.length&&i<items2.length; i++){
            if(!items[i].equals(items2[i])){
                diff += items[i]+"->"+items2[i].substring(items2[i].indexOf('=')+1)+",";
            }
        }

        return diff;
    }
}
