String fieldName = (fieldchild.getAttribute("Name")); //gives field name : opcode
String fieldCustomID = (fieldchild.getAttribute("ID")); //gives id: 2022
String classTypeofField = IdNameMappingList.get(fieldCustomID).toString(); //give class name OpCodeClass
FieldSpec fieldSpec = FieldSpec.builder(**some code**, fieldName)
.build();
应提供类似的内容:
OpCodeClass opcode;
其他解决方法也受到赞赏。
答案 0 :(得分:0)
尝试ClassName.get("com.company.app", classTypeofField)
,将包名称替换为该类的名称。