当前位置:网站首页>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 :
边栏推荐
- mysql -connector/j驱动下载
- Xiaomai technology x hologres: high availability of real-time data warehouse construction of ten billion level advertising
- Adobe Premiere基础-常用的视频特效(裁剪,黑白,剪辑速度,镜像,镜头光晕)(十五)
- 记录服务器被入侵病毒:ssh密码被更改登录失败、恶意程序跑满了cpu、jar包启动失败自动kill、一直弹出You have new mail in /var/spool/mail/root
- Adobe Premiere基础-常用的视频特效(边角定位,马赛克,模糊,锐化,手写工具,效果控件层级顺序)(十六)
- If the evaluation conclusion of waiting insurance is poor, does it mean that waiting insurance has been done in vain?
- 【目标跟踪】|stark配置 win otb
- [tcapulusdb knowledge base] tcapulusdb doc acceptance - transaction execution introduction
- Stepping on the pit: json Parse and json stringify
- 【网络是怎么连接的】第三章 探索集线器,交换机和路由器
猜你喜欢

Adobe Premiere Basics - common video effects (cropping, black and white, clip speed, mirroring, lens halo) (XV)

Adobe Premiere基础-不透明度(混合模式)(十二)

Adobe Premiere基础-常用的视频特效(裁剪,黑白,剪辑速度,镜像,镜头光晕)(十五)

JS merge two 2D arrays and remove the same items (collation)

Us judge ruled that the former security director of Uber accused of covering up hacking must face fraud charges

Markdown knowledge comes gently

源码安装MAVROS

关于微服务

Adobe Premiere基础-编辑素材文件常规操作(脱机文件,替换素材,素材标签和编组,素材启用,便捷调节不透明度,项目打包)(十七)

Anaconda安装并配置jupyter notebook远程
随机推荐
报错Failed to allocate graph: MYRIAD device is not opened.
Adobe Premiere foundation - batch material import sequence - variable speed and rewind (recall) - continuous action shot switching - subtitle requirements (13)
Us judge ruled that the former security director of Uber accused of covering up hacking must face fraud charges
Adobe Premiere Basics - common video effects (corner positioning, mosaic, blur, sharpen, handwriting tools, effect control hierarchy) (16)
Sd6.23 summary of intensive training
优雅书写Controller(参数验证+统一异常处理)
Adobe Premiere foundation - opacity (mixed mode) (XII)
【TcaplusDB知识库】TcaplusDB单据受理-创建游戏区介绍
Xiaomai technology x hologres: high availability of real-time data warehouse construction of ten billion level advertising
Maximum length of palindrome substring (string hash + binary)
Image migration and data migration synchronization of old and new servers with different Alibaba cloud accounts
[tcapulusdb knowledge base] tcapulusdb doc acceptance - Introduction to creating game area
js两个一维数组合并并去除相同项(整理)
RocketMQ的tag过滤和sql过滤
Kubekey2.2.1 kubernetes1.23.7 offline package production +harbor Department summer and upload image
软件测试——基础理论知识你都不一定看得懂
DevCloud加持下的青软,让教育“智”上云端
Stepping on the pit: json Parse and json stringify
How do I add SmartArt to slides in PowerPoint?
js两个二维数组合并并去除相同项(整理)