当前位置:网站首页>Usage of BeanUtils property replication
Usage of BeanUtils property replication
2022-06-29 18:26:00 【thoughtCodes】
1. For types of Boolean/Short/Integer/Float/Double Properties of , It will translate into 0:
demand 1: If B A field in has a value ( Not for null), This field is not copied ; That is to say B When there is no value in this field , To copy , Suitable for B Supplementary value .
import org.apache.commons.beanutils.BeanUtilsBean;
import org.apache.commons.beanutils.PropertyUtils;
public class CopyWhenNullBeanUtilsBean extends BeanUtilsBean{
@Override
public void copyProperty(Object bean, String name, Object value)
throws IllegalAccessException, InvocationTargetException {
try {
Object destValue = PropertyUtils.getSimpleProperty(bean, name);
if (destValue == null) {
super.copyProperty(bean, name, value);
}
} catch (NoSuchMethodException e) {
throw new RuntimeException(e);
}
}
}
import org.apache.commons.beanutils.BeanUtilsBean;
public class CopyFromNotNullBeanUtilsBean extends BeanUtilsBean {
@Override
public void copyProperty(Object bean, String name, Object value) throws IllegalAccessException, InvocationTargetException {
if (value == null) {
return;
}
super.copyProperty(bean, name, value);
}
}
Special Usage :
边栏推荐
- Error building sqlsession problem
- Sd6.25 summary of intensive training
- PostgreSQL database system table
- VMware安装ESXI
- How do I add SmartArt to slides in PowerPoint?
- SD6.25集训总结
- Abc253 D fizzbuzz sum hard (tolerance exclusion theorem)
- QQ如何开通在线客服
- If the evaluation conclusion of waiting insurance is poor, does it mean that waiting insurance has been done in vain?
- [target tracking] |stark configuration win OTB
猜你喜欢

NVIDIA installs the latest graphics card driver

Adobe Premiere基础-常用的视频特效(边角定位,马赛克,模糊,锐化,手写工具,效果控件层级顺序)(十六)

Image migration and data migration synchronization of old and new servers with different Alibaba cloud accounts

Adobe Premiere foundation - opacity (matte) (11)

JWT登录验证

Xiaobai yuesai 51 supplement e g f

jdbc_ Related codes

Servlet student management system (Mengxin hands-on version)

Wechat applet development reserve knowledge

How QQ opens online customer service
随机推荐
Travel card "star picking" hot search first! Stimulate the search volume of tourism products to rise
[tcapulusdb knowledge base] tcapulusdb doc acceptance - table creation approval introduction
jdbc_ Related codes
Maxcompute string replacement function -replace
js两个一维数组合并并去除相同项(整理)
Wechat applet development reserve knowledge
Adobe Premiere foundation - opacity (matte) (11)
garbage collector
mysql -connector/j驱动下载
If the evaluation conclusion of waiting insurance is poor, does it mean that waiting insurance has been done in vain?
It's really easy to make money in foreign lead and build a website
3H proficient in opencv (VIII) - shape detection
Adobe Premiere基础-常用的视频特效(裁剪,黑白,剪辑速度,镜像,镜头光晕)(十五)
Precondition end of script headers or end of script output before headers
VMware安装ESXI
Adobe Premiere Basics - general operations for editing material files (offline files, replacing materials, material labels and grouping, material enabling, convenient adjustment of opacity, project pa
Us judge ruled that the former security director of Uber accused of covering up hacking must face fraud charges
Servlet student management system (Mengxin hands-on version)
NVIDIA installs the latest graphics card driver
When easycvr deploys a server cluster, what is the reason why one is online and the other is offline?