package com.maestrano.account;

import java.lang.reflect.Field;
import java.util.HashMap;
import java.util.Map;

class MnoObject {
	public Map<String,Object> changedAttributes;
	public Map<String,Object> orginalAttributes;
	
	public MnoObject() {
		changedAttributes = new HashMap<String,Object>();
		orginalAttributes = new HashMap<String,Object>();
	}
	
	protected void changeAttribute(String attrName, Object value) {
		try {
			
			Field f = this.getClass().getDeclaredField(attrName);
			Object currentVal = f.get(this);
			f.set(this,value);
			
			if (this.orginalAttributes.get(attrName) == null) {
				this.orginalAttributes.put(attrName, currentVal);
			}
			
			if (this.orginalAttributes.get(attrName) != null 
					&& this.orginalAttributes.get(attrName).equals(value)) {
				this.changedAttributes.remove(attrName);
				this.orginalAttributes.remove(attrName);
			} else {
				this.changedAttributes.put(attrName, value);
			}
		
		} catch (Exception e) {}
	}
	
	protected void merge(Object obj) {
		Field[] fs = this.getClass().getDeclaredFields();
		
		for (Field f : fs) {
			try {
				f.set(this,f.get(obj));
			} catch (Exception e) {}
		}
	}
}

@@ -106,16 +106,92 @@
 l.Map;%0A%0A
+import com.google.gson.Gson;%0Aimport com.maestrano.net.MnoApiAccountClient;%0A%0A
 class Mn
@@ -421,24 +421,105 @@
 ct%3E();%0A%09%7D%0A%09%0A
+%09public String toString() %7B%0A%09%09return MnoApiAccountClient.GSON.toJson(this);%0A%09%7D%0A%09%0A
 %09protected v

better string representation