当前位置:网站首页>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 :
边栏推荐
- Maximum length of palindrome substring (string hash + binary)
- /usr/bin/ld: warning: **libmysqlclient. so. 20**, needed by //usr/
- jdbc_相关代码
- RocketMQ的tag过滤和sql过滤
- If the evaluation conclusion of waiting insurance is poor, does it mean that waiting insurance has been done in vain?
- 2022.6.29-----leetcode.535
- 6.29模拟赛总结
- Yolov6+tensorrt+onnx: deployment based on win10+tensorrt8+yolov6+onnx
- Adobe Premiere foundation - time remapping (10)
- Detailed analysis on the use of MySQL stored procedure loop
猜你喜欢

Adobe Premiere Basics - common video effects (corner positioning, mosaic, blur, sharpen, handwriting tools, effect control hierarchy) (16)

如何在树莓派上使用OAK相机?

Codeworks 5 questions per day (1700 for each) - the next day
MySql存储过程循环的使用分析详解

Adobe Premiere基础-常用的视频特效(边角定位,马赛克,模糊,锐化,手写工具,效果控件层级顺序)(十六)
Detailed analysis on the use of MySQL stored procedure loop

markdown知识轻轻来袭

Adobe Premiere foundation - opacity (mixed mode) (XII)

Niuke small Bai monthly race 52 D ring insectivorous (feet +st table)

报错Failed to allocate graph: MYRIAD device is not opened.
随机推荐
Detailed analysis on the use of MySQL stored procedure loop
SD6.24集训总结
Adobe Premiere foundation - sound adjustment (volume correction, noise reduction, telephone tone, pitch shifter, parameter equalizer) (XVIII)
Adobe Premiere foundation - time remapping (10)
Xiaomai technology x hologres: high availability of real-time data warehouse construction of ten billion level advertising
kubekey2.2.1 kubernetes1.23.7离线包制作+harbor部暑并上传镜像
JS merge two one-dimensional arrays and remove the same items (collation)
Proxmox VE Install 7.2
Source code installation mavros
Record that the server has been invaded by viruses: the SSH password has been changed, the login fails, the malicious program runs full of CPU, the jar package fails to start automatically, and you ha
Adobe Premiere基础-常用的视频特效(边角定位,马赛克,模糊,锐化,手写工具,效果控件层级顺序)(十六)
工作流模块Jar包启动报错:liquibase – Waiting for changelog lock….
shell教程之循环语句for,while,until用法
Travel card "star picking" hot search first! Stimulate the search volume of tourism products to rise
[tcapulusdb knowledge base] tcapulusdb doc acceptance - create business introduction
Automatic software test - read SMS verification code using SMS transponder and selenium
Adobe Premiere Basics - common video effects (corner positioning, mosaic, blur, sharpen, handwriting tools, effect control hierarchy) (16)
Sd6.25 summary of intensive training
535. encryption and decryption of tinyurl / Jianzhi offer II 103 Minimum number of coins
Longest XOR path (dfs+01trie)