MCPcopy Create free account
hub / github.com/Bit0r/java-util / getErrList

Method getErrList

src/main/java/util/CheckUtils.java:86–130  ·  view source on GitHub ↗

获取错误信息 @param objList @return

(List<?> objList, Map<String, Object> notNullInfoMap,  List<String> errList)

Source from the content-addressed store, hash-verified

84 * @return
85 */
86 private static List<String> getErrList(List<?> objList, Map<String, Object> notNullInfoMap, List<String> errList) {
87 for (int i = 0; i < objList.size(); i++) {
88 Object obj = objList.get(i);
89 String className = obj.getClass().getName();
90 PropertyDescriptor origDescriptors[] = PropertyUtils.getPropertyDescriptors(obj);
91 for (int j = 0; j < origDescriptors.length; j++) {
92 String k = origDescriptors[j].getName();
93 Object v = null;
94 try {
95 v = PropertyUtils.getSimpleProperty(obj, k);
96 } catch (Exception e) {
97 log.error(e.getMessage(), e);
98 }
99 Object notNullObject = notNullInfoMap.get(className+ SEPARATOR + k);
100 if (ObjectUtil.isNotEmpty(notNullObject)) {
101 if (ObjectUtil.isEmpty(v)) {
102 setErrList(errList, className+ SEPARATOR + k, i, objList.size());
103 }
104 }
105 if (ObjectUtil.isNotEmpty(v)) {
106 if (v instanceof List) {
107 List list = (List) v;
108 if(list!= null && list.get(0).getClass().getName().contains(SYSTEM)){
109 getErrList((List<?>) v, notNullInfoMap, errList);
110 }
111 } else {
112 if(v.getClass().getName().contains(SYSTEM)){
113 getErrList(Collections.singletonList(v), notNullInfoMap, errList);
114 }
115
116 }
117// Object subObjectObject = notNullInfoMap.get(prefix + k + SUB_OBJECT);
118// if (ObjectUtil.isNotEmpty(subObjectObject)) {
119// if (v instanceof List) {
120//
121// getErrList((List<?>) v, (Map<String, Object>) subObjectObject, prefix + k, errList);
122// } else {
123// getErrList(Collections.singletonList(v), (Map<String, Object>) subObjectObject, prefix + k, errList);
124// }
125// }
126 }
127 }
128 }
129 return errList;
130 }
131
132 /**
133 * 不为空判断-获取错误信息

Callers

nothing calls this directly

Calls 2

setErrListMethod · 0.95
getNotNullInfoMethod · 0.95

Tested by

no test coverage detected