@Data @AllArgsConstructor @NoArgsConstructor @ToString
时间: 2023-10-04 08:04:15 浏览: 96
lombok.jar(支持开发工具对“@Data”缺少插件而报错问题)
@ToString是Lombok提供的注解之一,用于自动生成类的toString方法。它可以直接在类上使用,例如在User类中使用了@Data注解后,不需要再显式添加@ToString注解,因为@Data已经包含了@ToString的功能。@AllArgsConstructor注解用于生成全参构造函数,@NoArgsConstructor用于生成无参构造函数。这两个注解可以方便地为类添加构造函数,避免了手动编写繁琐的构造函数代码。总结起来,@Data注解包含了@Getter、@Setter、@EqualsAndHashCode和@ToString这四个注解的功能,简化了类的定义。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [lombok之@NoArgsConstructor、@AllArgsConstructor和@Data注解](https://blog.csdn.net/y_bccl27/article/details/103380797)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *2* [lombok几个基本注解的使用@Data@AllArgsConstructor@NoArgsConstructor](https://blog.csdn.net/weixin_54345563/article/details/123915084)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *3* [java简便方法引入getter/setter/tostring等方法](https://download.csdn.net/download/qqzsloveyou/18929063)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"]
[ .reference_list ]
阅读全文