Understanding POJO Types and Using the Simple Object Copy Plugin for Java Object Mapping
This article explains the definitions and typical usage scenarios of various POJO types (VO, BO, PO, DTO, DO) in Java layered architecture, demonstrates how the Simple Object Copy IntelliJ plugin can generate one‑click conversion methods between them, compares it with other mapping tools, and provides installation instructions.
The article introduces the concepts of various POJO types such as VO (View Object), BO (Business Object), PO (Persistent Object), DTO (Data Transfer Object), and DO (Domain Object), explaining their typical usage scenarios in Java layered architecture.
It then presents the "Simple Object Copy" IntelliJ plugin, which can generate one‑click conversion methods between these objects, showing screenshots of the generated code and the resulting objects.
Sample source code for converting UserDTO to UserVO , including nested Role and Room objects, is provided:
@Data
public class UserVO {
private String name;
private Date entryDate;
private String userId;
private List
roleList;
private RoomVO room;
public static UserVO convertToUserVO(UserDTO item) {
if (item == null) {
return null;
}
UserVO result = new UserVO();
result.setName(item.getName());
result.setEntryDate(item.getEntryDate());
result.setUserId(item.getUserId());
List
roleList = item.getRoleList();
if (roleList == null) {
result.setRoleList(null);
} else {
result.setRoleList(roleList.stream().map(UserVO::convertToRoleVO).collect(Collectors.toList()));
}
result.setRoom(convertToRoomVO(item.getRoom()));
return result;
}
// similar convertToRoomVO and convertToRoleVO methods omitted for brevity
}The article compares the plugin with other mapping tools such as Spring BeanUtils, Cglib BeanCopier, Apache BeanUtils, Dozer, MapStruct, and JSON serialization, highlighting problems like code intrusion, performance overhead, and missing compile‑time checks.
It discusses the performance advantage of the plugin, its non‑intrusive nature, flexibility, and compatibility, and gives step‑by‑step instructions on how to install the plugin from the IntelliJ Marketplace.
Finally, the author adds promotional links to additional resources and invites readers to join a community group for further learning.
Java Architect Essentials
Committed to sharing quality articles and tutorials to help Java programmers progress from junior to mid-level to senior architect. We curate high-quality learning resources, interview questions, videos, and projects from across the internet to help you systematically improve your Java architecture skills. Follow and reply '1024' to get Java programming resources. Learn together, grow together.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.