Understanding POJO Types (VO, BO, PO, DTO, DO) and Using the Simple Object Copy Plugin for Code Generation
This article explains the different POJO classifications such as VO, BO, PO, DTO, and DO in Java, compares various object‑copy utilities, and demonstrates how the Simple Object Copy IDE plugin can automatically generate conversion methods to improve development efficiency and code quality.
POJO (Plain Old Java Object) is a simple, rule‑less object that can be categorized into several specialized types used throughout typical Java application layers.
VO (View Object/Value Object) represents data returned to the front‑end; it is created by converting a DTO in the service layer before sending it to the UI.
BO (Business Object) is an internal business‑level object used within services, often aggregating multiple other objects and handling core business logic before being transformed back to a DTO.
PO (Persistent Object) mirrors database records and stores data retrieved from the database without containing any business logic.
DTO (Data Transfer Object) is used for transferring data between different layers or services, helping to decouple components.
DO (Domain Object) has two meanings: in Alibaba’s handbook it is equivalent to PO, while in Domain‑Driven Design it aligns with BO.
The article introduces the Simple Object Copy IntelliJ plugin, which can generate conversion methods with a single shortcut (Alt+Insert or ⌘+N). After generation, missing fields appear as empty methods, prompting developers to implement them, thus reducing the risk of overlooking required mappings.
Compared with other tools such as Spring BeanUtils, Cglib BeanCopier, Apache BeanUtils, Dozer, MapStruct, or JSON serialization, the plugin avoids invasive API calls and heavy reflection or proxy mechanisms, offering better performance and clearer code.
Code examples show generated conversion methods for UserVO , RoomVO , and RoleVO , as well as manual alternatives using MapStruct and BeanUtils for contrast.
Additional advantages highlighted include flexibility, compatibility, and the ability to handle complex nested objects without extensive boilerplate.
To install, open IntelliJ IDEA's plugin marketplace and search for "Simple Object Copy".
Source: 码猿技术专栏.
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.