BaseDomain.java 3.74 KB
package com.diligrp.website.util.domain;

import java.io.Serializable;
import java.sql.Timestamp;

import com.alibaba.fastjson.JSONObject;

/**
 * <B>Description</B> Domain对象的父类,包含基本的一些属性 <br />
 * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br />
 * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br />
 * <B>Company</B> 地利集团
 * @createTime May 9, 2014 10:10:44 AM
 * @author wujianjun
 */
public abstract class BaseDomain implements Serializable {

    /**
     * 
     */
    private static final long serialVersionUID = -1L;

    protected Long id;
    protected Timestamp created;
    protected Timestamp modified;
    protected Integer yn;

    /**
     * create instance of BaseDomain
     * @createTime May 9, 2014 10:10:44 AM
     * @author wujianjun
     */
    public BaseDomain() {
    }

    /**
     * get value of BaseDomain.id
     * @return the id
     * @createTime May 9, 2014 10:16:16 AM
     * @author wujianjun
     */
    public Long getId() {
        return id;
    }

    /**
     * get value of BaseDomain.yn
     * @return the yn
     * @createTime May 9, 2014 10:53:41 AM
     * @author wujianjun
     */
    public Integer getYn() {
        return yn;
    }

    /**
     * set value of BaseDomain.yn
     * @param yn the yn to set
     * @createTime May 9, 2014 10:53:41 AM
     * @author wujianjun
     */
    public void setYn(Integer yn) {
        this.yn = yn;
    }

    /**
     * set value of BaseDomain.id
     * @param id the id to set
     * @createTime May 9, 2014 10:16:16 AM
     * @author wujianjun
     */
    public void setId(Long id) {
        this.id = id;
    }

    /**
     * get value of BaseDomain.created
     * @return the created
     * @createTime May 9, 2014 10:16:16 AM
     * @author wujianjun
     */
    public Timestamp getCreated() {
        return created;
    }

    /**
     * set value of BaseDomain.created
     * @param created the created to set
     * @createTime May 9, 2014 10:16:16 AM
     * @author wujianjun
     */
    public void setCreated(Timestamp created) {
        this.created = created;
    }

    /**
     * get value of BaseDomain.modified
     * @return the modified
     * @createTime May 9, 2014 10:16:16 AM
     * @author wujianjun
     */
    public Timestamp getModified() {
        return modified;
    }

    /**
     * set value of BaseDomain.modified
     * @param modified the modified to set
     * @createTime May 9, 2014 10:16:16 AM
     * @author wujianjun
     */
    public void setModified(Timestamp modified) {
        this.modified = modified;
    }

    /*
     * (non-Javadoc)
     * @see java.lang.Object#hashCode()
     */
    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((id == null) ? 0 : id.hashCode());
        return result;
    }

    /*
     * (non-Javadoc)
     * @see java.lang.Object#equals(java.lang.Object)
     */
    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (getClass() != obj.getClass())
            return false;
        BaseDomain other = (BaseDomain) obj;
        if (id == null) {
            if (other.id != null)
                return false;
        } else if (!id.equals(other.id))
            return false;
        return true;
    }

    /*
     * (non-Javadoc)
     * @see java.lang.Object#toString()
     */
    @Override
    public abstract String toString();

    /**
     * 转换成JsonString
     * @return json String
     * @createTime May 9, 2014 10:17:15 AM
     * @author wujianjun
     */
    public String toJsonString() {
        return JSONObject.toJSONString(this);
    }

}