基本上我需要以名称值对格式递归地打印所有实例变量名称及其值。说我的班级结构如下
public class SomeClass{
private String classDescription;
private Animals animals;
private Birds birds;
private List<Insects> insects;
private Map<String, Reptiles> others;
}
public class Animals{
private Dogs dogs;
private Cats cats;
private List<Mammals> mammalsList;
}
public class Dogs{
private String variable1;
private long variable2;
}
对于上面我有对象引用链的类结构,我需要递归地打印实例变量名称和相应的值。代码会很有帮助。