📄 entitybase.java
字号:
package com.royee.ecport.pojo;
import java.io.Serializable;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import com.royee.ecport.exception.RoyeeClassNotMatchException;
public abstract class EntityBase extends PojoBase implements Serializable{
public void copyPropertiesFrom(EntityBase eb){
if(!eb.getClass().equals(this.getClass()))
throw new RoyeeClassNotMatchException();
Field[] fields=this.getClass().getDeclaredFields();
for(Field field:fields){
if(Modifier.isFinal(field.getModifiers()))
continue;
if(Modifier.isStatic(field.getModifiers()))
continue;
field.setAccessible(true);
try {
if(field.get(eb)!=null)
field.set(this, field.get(eb));
} catch (IllegalArgumentException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalAccessException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -