⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 abstractbusinessobject.java

📁 struts+spring+hibernate自创框架
💻 JAVA
字号:
package com.pegasus.framework.pojo;

import java.beans.PropertyDescriptor;
import java.lang.reflect.InvocationTargetException;
import java.util.Iterator;
import java.util.Map;

import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.beanutils.DynaBean;
import org.apache.commons.beanutils.DynaProperty;
import org.apache.commons.beanutils.PropertyUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.pegasus.framework.exception.NestedRuntimeException;
import com.pegasus.framework.exception.POJOException;
import com.pegasus.framework.util.ObjectUtil;

public abstract class AbstractBusinessObject implements IBusinessObject, Cloneable {
	protected final Log logger = LogFactory.getLog(this.getClass());
	protected Integer version;
	protected String deleted;
	/**
	 * @return Returns the id.
	 */
	public abstract Long getId();

	/**
	 * @param id
	 * The id to set.
	 */
	public abstract void setId(Long id);
	
	

	public IBusinessObject clone(IBusinessObject object) throws POJOException {
		try {
			BeanUtils.copyProperties(this, object);
		} catch (IllegalAccessException e) {
			throw new POJOException("error in POJO clone", e);
		} catch (InvocationTargetException e) {
			throw new POJOException("error in POJO clone", e);
		}
		return this;
	}

	public Object clone() {
		try {
			return super.clone();
		} catch (CloneNotSupportedException e) {
			throw new NestedRuntimeException("This should never happen!");
		}
	}
	
	public boolean isIDEmpty() {
		if(getId() == null || getId().longValue() == 0) {
			return true;
		} else {
			return false;
		}
	}
	
	public String toXMLString() {
        return ObjectUtil.toXMLString(getClass(), this);
    }
	
	public boolean compareProperties(Object dest) {
		 return ObjectUtil.compareProperties(dest, this);
	}
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	

	/**
	 * @return Returns the version.
	 */
	public Integer getVersion() {
		return version;
	}

	/**
	 * @param version The version to set.
	 */
	public void setVersion(Integer version) {
		this.version = version;
	}

	/**
	 * @return Returns the deleted.
	 */
	public String getDeleted() {
		return deleted;
	}

	/**
	 * @param deleted The deleted to set.
	 */
	public void setDeleted(String deleted) {
		this.deleted = deleted;
	}

	
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -