// Path: leotask/src/core/org/leores/ecpt/TRuntimeException.java
// public class TRuntimeException extends RuntimeException {
// 	private static final long serialVersionUID = -1540271937983801068L;
// 
// 	public TRuntimeException() {
// 		super();
// 		return;
// 	}
// 
// 	public TRuntimeException(Object obj) {
// 		super(U.toStr(obj));
// 		return;
// 	}
// 
// 	public TRuntimeException(Object... objs) {
// 		this("", objs);
// 		return;
// 	}
// 
// 	public TRuntimeException(String str, Object... objs) {
// 		super(str + U.toStr(objs));
// 		return;
// 	}
// }
// 
// Path: leotask/src/core/org/leores/util/able/Processable1.java
// public interface Processable1<R, A> {
// 	public R process(A a);
// 
// 	public static class MaxListOutSize<A> implements Processable1<String, A> {
// 		protected Integer mSize;// null means do no limit list out size
// 
// 		public MaxListOutSize(Integer mSize) {
// 			this.mSize = mSize;
// 		}
// 
// 		public String process(A a) {
// 			String rtn = null;
// 			if (a != null && U.bAssignable(List.class, a.getClass())) {
// 				List lObj = (List) a;
// 				if (mSize != null && mSize >= 0 && mSize < lObj.size()) {
// 					List lOut = lObj.subList(0, mSize);
// 					rtn = lOut + "...";
// 				} else {
// 					rtn = lObj + "";
// 				}
// 			}
// 			return rtn;
// 		}
// 	}
// 
// 	public static class ArrayToString<A> implements Processable1<String, A> {
// 		public String process(A a) {
// 			String rtn = a + "";
// 			if (a != null && a instanceof Object[]) {
// 				rtn = "[";
// 				Object[] aa = (Object[]) a;
// 				for (int i = 0; i < aa.length; i++) {
// 					rtn += aa[i];
// 					if (i + 1 < aa.length) {
// 						rtn += ",";
// 					}
// 				}
// 				rtn += "]";
// 			}
// 			return rtn;
// 		}
// 	}
// 
// 	public static class Expression<A> implements Processable1<A, A> {
// 		public String sElement, sExpression;
// 
// 		public Expression(String sElement, String sExpression) {
// 			this.sElement = sElement;
// 			this.sExpression = sExpression;
// 		}
// 
// 		public Expression(String sExpression) {
// 			this("%", sExpression);
// 		}
// 
// 		public A process(A a) {
// 			A rtn = a;
// 			if (a != null) {
// 				String sExpToEval = sExpression.replace(sElement, a + "");
// 				BigDecimal bdEvalRtn = U.eval1Expression(sExpToEval);
// 				if (bdEvalRtn != null) {
// 					rtn = (A) U.newInstance(a.getClass(), bdEvalRtn + "");
// 				} else {
// 					rtn = null;
// 				}
// 			}
// 			return rtn;
// 		}
// 
// 	}
// }


import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.leores.ecpt.TRuntimeException;
import org.leores.util.able.Processable1;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;

	 * Load fields' value of tObj from a xml file fn. This function does not
	 * support Primitive Data Types. They has to be replaced by their
	 * corresponding Object classes. e.g. double->Double
	 * 
	 * @param tObj
	 * @param sFile
	 * @param bUnMatchException
	 *            true: throw a TRuntimeException when the root element does not
	 *            match the Object class.
	 * @return
	 */
	public static boolean loadFromXML(Object tObj, String sFile, boolean bUnMatchException) {
		boolean rtn = false;

		if (tObj != null && U.valid(sFile)) {
			if (U.bExistFile(sFile)) {
				try {
					File file = new File(sFile);
					DocumentBuilderFactory dBFactory = DocumentBuilderFactory.newInstance();
					DocumentBuilder dBuilder;
					dBuilder = dBFactory.newDocumentBuilder();
					Document doc = dBuilder.parse(file);
					doc.getDocumentElement().normalize();

					Class objClass = tObj.getClass();
					Element eRoot = doc.getDocumentElement();
					String objClassName = objClass.getName();
					String docRootName = eRoot.getNodeName();

					if (objClassName.indexOf(docRootName) < 0 && bUnMatchException) {

// Path: leotask/src/core/org/leores/ecpt/TRuntimeException.java
// public class TRuntimeException extends RuntimeException {
// 	private static final long serialVersionUID = -1540271937983801068L;
// 
// 	public TRuntimeException() {
// 		super();
// 		return;
// 	}
// 
// 	public TRuntimeException(Object obj) {
// 		super(U.toStr(obj));
// 		return;
// 	}
// 
// 	public TRuntimeException(Object... objs) {
// 		this("", objs);
// 		return;
// 	}
// 
// 	public TRuntimeException(String str, Object... objs) {
// 		super(str + U.toStr(objs));
// 		return;
// 	}
// }
// 
// Path: leotask/src/core/org/leores/util/able/Processable1.java
// public interface Processable1<R, A> {
// 	public R process(A a);
// 
// 	public static class MaxListOutSize<A> implements Processable1<String, A> {
// 		protected Integer mSize;// null means do no limit list out size
// 
// 		public MaxListOutSize(Integer mSize) {
// 			this.mSize = mSize;
// 		}
// 
// 		public String process(A a) {
// 			String rtn = null;
// 			if (a != null && U.bAssignable(List.class, a.getClass())) {
// 				List lObj = (List) a;
// 				if (mSize != null && mSize >= 0 && mSize < lObj.size()) {
// 					List lOut = lObj.subList(0, mSize);
// 					rtn = lOut + "...";
// 				} else {
// 					rtn = lObj + "";
// 				}
// 			}
// 			return rtn;
// 		}
// 	}
// 
// 	public static class ArrayToString<A> implements Processable1<String, A> {
// 		public String process(A a) {
// 			String rtn = a + "";
// 			if (a != null && a instanceof Object[]) {
// 				rtn = "[";
// 				Object[] aa = (Object[]) a;
// 				for (int i = 0; i < aa.length; i++) {
// 					rtn += aa[i];
// 					if (i + 1 < aa.length) {
// 						rtn += ",";
// 					}
// 				}
// 				rtn += "]";
// 			}
// 			return rtn;
// 		}
// 	}
// 
// 	public static class Expression<A> implements Processable1<A, A> {
// 		public String sElement, sExpression;
// 
// 		public Expression(String sElement, String sExpression) {
// 			this.sElement = sElement;
// 			this.sExpression = sExpression;
// 		}
// 
// 		public Expression(String sExpression) {
// 			this("%", sExpression);
// 		}
// 
// 		public A process(A a) {
// 			A rtn = a;
// 			if (a != null) {
// 				String sExpToEval = sExpression.replace(sElement, a + "");
// 				BigDecimal bdEvalRtn = U.eval1Expression(sExpToEval);
// 				if (bdEvalRtn != null) {
// 					rtn = (A) U.newInstance(a.getClass(), bdEvalRtn + "");
// 				} else {
// 					rtn = null;
// 				}
// 			}
// 			return rtn;
// 		}
// 
// 	}
// }


// Path: leotask/src/core/org/leores/util/SerialUtil.java
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.leores.ecpt.TRuntimeException;
import org.leores.util.able.Processable1;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;

	 * Load fields' value of tObj from a xml file fn. This function does not
	 * support Primitive Data Types. They has to be replaced by their
	 * corresponding Object classes. e.g. double->Double
	 * 
	 * @param tObj
	 * @param sFile
	 * @param bUnMatchException
	 *            true: throw a TRuntimeException when the root element does not
	 *            match the Object class.
	 * @return
	 */
	public static boolean loadFromXML(Object tObj, String sFile, boolean bUnMatchException) {
		boolean rtn = false;

		if (tObj != null && U.valid(sFile)) {
			if (U.bExistFile(sFile)) {
				try {
					File file = new File(sFile);
					DocumentBuilderFactory dBFactory = DocumentBuilderFactory.newInstance();
					DocumentBuilder dBuilder;
					dBuilder = dBFactory.newDocumentBuilder();
					Document doc = dBuilder.parse(file);
					doc.getDocumentElement().normalize();

					Class objClass = tObj.getClass();
					Element eRoot = doc.getDocumentElement();
					String objClassName = objClass.getName();
					String docRootName = eRoot.getNodeName();

					if (objClassName.indexOf(docRootName) < 0 && bUnMatchException) {

						throw new TRuntimeException("loadFromXML: root element does not match the Object class! [sFile,objClassName,docRootName]:", sFile, objClassName, docRootName);
