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

Method getNotNullInfo

src/main/java/util/CheckUtils.java:38–79  ·  view source on GitHub ↗

获取字段和注解相关信息 @param objectClazz @param annotationClass @return k-字段名称 v-注解信息

(Class<?> objectClazz, Class annotationClass,Set<String> classNameSet, Map<String, Object> getAnnotateInfoMap)

Source from the content-addressed store, hash-verified

36 * @return k-字段名称 v-注解信息
37 */
38 private static Map<String, Object> getNotNullInfo(Class<?> objectClazz, Class annotationClass,Set<String> classNameSet, Map<String, Object> getAnnotateInfoMap) {
39 if(classNameSet == null){
40 classNameSet = new HashSet<>();
41 }
42 if(getAnnotateInfoMap == null){
43 getAnnotateInfoMap = new HashMap<>();
44 }
45
46 String className = objectClazz.getName();
47 if(classNameSet.contains(className)){
48 return getAnnotateInfoMap;
49 }
50 classNameSet.add(className);
51// Map<String, Object> getAnnotateInfoMap = new HashMap<>();
52
53 List<Field> fieldList = TableInfoHelper.getAllFields(objectClazz);
54
55 for (Field field : fieldList) {
56 Object annotate = field.getAnnotation(annotationClass);
57 if (annotate != null) {
58 getAnnotateInfoMap.put(className +SEPARATOR+ field.getName(), annotate);
59 }
60 if (List.class.equals(field.getType())) {
61 Type type = field.getGenericType();
62 if (type != null) {
63 if (type instanceof ParameterizedType) {
64 ParameterizedType pt = (ParameterizedType) type;
65 Class sonObjectClass = (Class) pt.getActualTypeArguments()[0];
66 Map<String, Object> sonObjectAnnotateInfoMap = getNotNullInfo(sonObjectClass, annotationClass, classNameSet,getAnnotateInfoMap);
67
68// getAnnotateInfoMap.put(prefix + field.getName() + SUB_OBJECT, sonObjectAnnotateInfoMap);
69 }
70 }
71 } else if (field.getType().toString().contains(SYSTEM)) {
72 Map<String, Object> sonObjectAnnotateInfoMap = getNotNullInfo(field.getType(), annotationClass, classNameSet,getAnnotateInfoMap);
73// getAnnotateInfoMap.put(prefix + field.getName() + SUB_OBJECT, sonObjectAnnotateInfoMap);
74 }
75
76
77 }
78 return getAnnotateInfoMap;
79 }
80
81 /**
82 * 获取错误信息

Callers 1

getErrListMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected