如何使用java反射迭代Field类型List

Pra*_*oli 1 java reflection

我有一个名为User的类,它具有这样的Account类对象列表

 public class User{
   private List<Account> accounts = new ArrayList<Account>();
 }
Run Code Online (Sandbox Code Playgroud)

Account对象有一个瞬态字段,我想找到它并做一些事情

public class Account{
  private transient openDateInOrgDateFormat;
}
Run Code Online (Sandbox Code Playgroud)

这个字段我想找到使用反射,然后检查它的瞬态然后做什么.通过反射如何找到类型集合的字段然后迭代它并查找列表中的对象内的字段是否是瞬态的.

Psh*_*emo 6

由于我不知道究竟是什么阻止您编写代码,因此这里有一些应该有用的工具: