public static <T> void Model2doc_childs (T t,document reqdata, Node parentnode) throws IllegalArgumentException, Ill egalaccessexception {
Class<?> clazz = T.getclass ();
field[] fields = Clazz.getfields ();
for (Field f:fields) {
System.out.println (F.gettype ());
if (F.gettype (). Equals (String.class) | | F.gettype (). Equals (Integer.class)) {
Node N_node = reqdata.createelement (F.getname ());
System.out.println (F.getname ());
F.setaccessible (TRUE);
String value=string.valueof (F.get (t));
/*n_node.appendchild (Reqdata.createtextnode (xmlmodelutil
. GetProperty (T, F.getname ()). ToString ()); * *
N_node.appendchild (Reqdata.createtextnode (value));
Parentnode.appendchild (N_node);
}
}
/* field[] fields= t.getclass (). Getdeclaredfields ();
for (Field f:fields) {
if (F.gettype (). Equals (Qrybatchstateinforesponsemodel.class)) {
F.setaccessible (TRUE);
Qrybatchstateinforesponsemodel a= (Qrybatchstateinforesponsemodel) f.get (t);
field[] Declaredfields = QryBatchStateInfoResponseModel.class.getDeclaredFields ();
for (Field field:declaredfields) {
if (!field.gettype (). Equals (List.class)) {
Node N_node = reqdata.createelement (Field.getname ());
System.out.println (Field.getname ());
N_node.appendchild (Reqdata.createtextnode (Xmlmodelutil.getproperty (A, Field.getname ()). ToString ());
Parentnode.appendchild (N_node);
}
}
}
}*/
}
Java reflection Gets the value of the property and sets the value of the property