package com.example.demo.prototype;
import org.springframework.beans.BeanUtils;
public class Player {
private String name;
private String age;
private String email;
private Integer ff;
public Player() {
// Utils.setDefaultFiled(this);
}
@Override
public String toString() {
return "Player{" +
"name="" + name + "\"" +
", age="" + age + "\"" +
", email="" + email + "\"" +
", ff=" + ff +
"}";
}
public static void main(String[] args) throws InstantiationException, IllegalAccessException {
Player player = new Player();
player.age = "234";
player.name = "asd";
player.email = "qq";
player.ff = 34;
Player player2 = new Player();
BeanUtils.copyProperties(player, player2);
BeanUtils.copyProperties(player2, player);
System.out.println(player2.toString());
System.out.println(player.toString());
}
}
Player {name="null", age="null", email="null", ff=null}
Player {name="asd", age="234", email="qq", ff=34}
Process finished with exit code 0