INNER CODE UNIT · Java
createRouterAttrDocJson
xiaojinzi123/Component · ComponentCompiler/src/main/java/com/xiaojinzi/component/AutowireProcessor.java:218
private void createRouterAttrDocJson() throws IOException {
if (!isRouterDocEnable()) {
return;
}
File attrFolder = new File(routerDocFolder, "attr");
if (attrFolder.exists() && attrFolder.isFile()) {
attrFolder.delete();
}
attrFolder.mkdirs();
Set<Map.Entry<TypeElement, Set<VariableElement>>> entrySet = map.entrySet();
Gson gson = new Gson();
// 循环, key 是目标 class, value 是 该 class 下所有待注入的字段
for (Map.Entry<TypeElement, Set<VariableElement>> entry : entrySet) {
List<ActivityAttrDocBean> activityAttrDocBeans = new ArrayList<>();
TypeElement targetClass = entry.getKey();
TypeMirror targetClassTypeMirror = targetClass.asType();
// 如果是 Activity