当前位置:网站首页>The list attribute in the entity is empty or null, and is set to an empty array
The list attribute in the entity is empty or null, and is set to an empty array
2022-04-23 05:42:00 【wyazyf】
/**
* // Handling empty arrays
* @param object
* @throws Exception
*/
public static void getObjectValue(Object object) throws Exception {
if (object != null) {//if (object!=null ) ----begin
// Get this kind of
Class<?> clz = object.getClass();
// Gets all properties of the entity class , return Field Array
Field[] fields = clz.getDeclaredFields();
for (Field field : fields) {// --for() begin
if(field.getGenericType().toString().contains("java.util.List")){
if(field.get(object)==null){
field.setAccessible(true);
field.set(object,new ArrayList<>());
// System.out.println(" Property name :" + field.getName());
// System.out.println(" Attribute types :" + field.getGenericType());
// System.out.println(" Property value :" + String.valueOf(field.get(object)));
}
}
}
}
}
版权声明
本文为[wyazyf]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230538215211.html
边栏推荐
- After adding qmenu to qtoolbutton and QPushButton, remove the triangle icon in the lower right corner
- refused connection
- The role of brackets' [] 'in the parameter writing method in MDN documents
- Frequently asked interview questions - 2 (computer network)
- QT drawpixmap and DrawImage blur problem
- QT displays the specified position and size of the picture
- Fast application fuzzy search
- 弘玑|数字化时代下,HR如何进行自我变革和组织变革?
- Common protocols of OSI layer
- 橙单微服务之批量导入
猜你喜欢

Common protocols of OSI layer

第36期《AtCoder Beginner Contest 248 打比赛总结》

Breadth first search topics (BFS)
![[the background color changes after clicking a line]](/img/3a/709d47fd3a370d86569fb9b560b403.png)
[the background color changes after clicking a line]

Cross platform packaging of QT packaging program

转置卷积(Transposed Convolution)

Create a tabbar component under the components folder, which is public

On the use of constant pointer and pointer constant -- exercise (record)

Data mining -- understanding data

弘玑Cyclone RPA为国金证券提供技术支撑,超200个业务场景实现流程自动化
随机推荐
What financial products will benefit during May Day?
Simple and basic use of switch and if
Understand the relationship between promise async await
踩坑:nacos利用startup.cmd -m standalone启动错误
实体中list属性为空或者null,设置为空数组
Flutter nouvelle génération de rendu graphique Impeller
弘玑微课堂 | Cyclone RPA之“灵活的数字员工”执行器
qt. qpa. plugin: Could not find the Qt platform plugin “xcb“ in ““
Mysql 查询使用\G,列转行
Sea Level Anomaly 和 Sea Surface Height Anomaly 的区别
poi生成excel,插入图片
Summary of redis classic interview questions 2022
Excel sets row and column colors according to cell contents
QT drawpixmap and DrawImage blur problem
Create cells through JS (while loop)
refused connection
Cross platform packaging of QT packaging program
3d slicer中拉直体的生成
Markdown syntax support test
Deep learning object detection