對(duì)象比較復(fù)雜,對(duì)象擁有其他對(duì)象,最好的實(shí)現(xiàn)方式是什么
認(rèn)證高級(jí)PHP講師
Java is not as convenient as js to get attribute fields. You have to use reflection
There is no other way to obtain the properties and values ????of two objects through reflection and then traverse
A convenient way is to convert the object into a map, then traverse the attributes, and finally convert the map back to the object. This process can be done with json-related tools such as gson or fastjson