All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.yqjr.framework.base.BaseBean Maven / Gradle / Ivy

/**
 * 
 */
package com.yqjr.framework.base;

import java.io.Serializable;

import org.apache.commons.lang3.builder.ToStringBuilder;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.yqjr.framework.component.mapper.BeanMapper;
import com.yqjr.framework.datatype.BizzException;
import com.yqjr.framework.utils.Reflections;

/**
 * ClassName: BaseBean 
* Description: Bean基类
* Create By: admin
* Create Date: 2017年4月26日 下午8:34:27
* Modified By:
* Modified Date:
* Modified Content:
* Version: 1.0
*/ public class BaseBean implements BaseCloneable, Serializable { private static final long serialVersionUID = -6670241604310538606L; @JsonIgnore protected Class clazz; @SuppressWarnings("unchecked") public BaseBean() { this.clazz = Reflections.getClassGenricType(this.getClass(), 1); } /** * @return the clazz */ public Class getClazz() { return clazz; } public T clone() { try { T instance = clazz.newInstance(); BeanMapper.beanToBean(this, instance, true, false); return instance; } catch (Exception e) { throw new BizzException(e); } } public T newInstance() { try { T instance = clazz.newInstance(); return instance; } catch (Exception e) { throw new BizzException(e); } } public String toString() { return ToStringBuilder.reflectionToString(this); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy