首页>代码>Struts2.3.5+Hibernate3+Spring3.1基于注解实现的多文件上传,下载>/FileUploadDownLoad/FileUploadDownLoad/src/cn/gov/csdn/base/model/BaseEntity.java
package cn.gov.csdn.base.model; import java.io.Serializable; import java.lang.reflect.Field; import java.lang.reflect.Modifier; import java.util.Date; import cn.gov.csdn.base.exception.BaseException; /** * File: BaseEntity.java * Author: admin * Version: 1.0 * Date: 2014/01/02 15:33 * Modify: * Description:用于继承 * Copyright csdn */ public abstract class BaseEntity implements Serializable{ public abstract Integer getId(); public abstract void setId(Integer id); //重写所有所有bewan的toString, //以达到在GenericLogger中显示所有字段信息的功能 @SuppressWarnings("rawtypes") public String toString() { Class clazz = this.getClass(); String className = clazz.getSimpleName(); StringBuffer buffer = new StringBuffer(); buffer.append(className + "{"); try { // Field[] fs = clazz.getDeclaredFields(); Class ftype = null ; String fname = null ; Object fvalue = null ; for(Field f :fs){ f.setAccessible(true); ftype = f.getType(); fname = f.getName(); fvalue = f.get(this); if((ftype.isPrimitive() || ftype == String.class || ftype == Integer.class || ftype == Long.class || ftype == Date.class) && !Modifier.isStatic(f.getModifiers())){ buffer.append(fname + ":" + fvalue + ","); } } } catch (Exception e) { e.printStackTrace(); throw new BaseException(); } buffer.append("}"); return buffer.toString(); } }

597117933 LV9
2020年12月17日
17704627276 LV17
2020年10月19日
annazhang LV29
2020年7月19日
lwp011 LV27
2020年7月7日
1404002391 LV12
2020年5月20日
912299793 LV21
2020年5月15日
angujj LV1
2020年3月23日
13148918399 LV9
2019年12月10日
592381035 LV1
2019年12月5日
hzhsh0223 LV18
2019年9月18日