Person source = new Person("John", 25);
Person destination = new Person();
BeanUtils.copyProperties(destination, source);
Map<String, Object> properties = new HashMap<>();
properties.put("name", "John");
properties.put("age", 25);
Person person = new Person();
BeanUtils.populate(person, properties);
Person person = new Person("John", 25);
String name = BeanUtils.getProperty(person, "name");
Maven:
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils-core</artifactId>
<version>1.9.4</version>
</dependency>
Gradle:
groovy
implementation 'commons-beanutils:commons-beanutils-core:1.9.4'