如何快速生成class的setter和getter方法
===========================

1.  在类内部，右键点击，选择“生成”。
    
    ![](https://contentcenter-vali-drcn.dbankcdn.cn/pvt_2/DeveloperAlliance_scene_100_1/8e/v3/v1hK0pAaSdKfhps9pHryJA/zh-cn_image_0000002229758765.png?HW-CC-KV=V1&HW-CC-Date=20260612T074650Z&HW-CC-Expire=86400&HW-CC-Sign=B70A51D205170474EDCCF5EA62E76915249FBF47FD8527D8A3B72744AA7D3BB3 "点击放大")
    
2.  选择Getter and Setter。
    
    ![](https://contentcenter-vali-drcn.dbankcdn.cn/pvt_2/DeveloperAlliance_scene_100_1/6a/v3/znvG_WuTRoGaJjYNgEnOTw/zh-cn_image_0000002229604269.png?HW-CC-KV=V1&HW-CC-Date=20260612T074650Z&HW-CC-Expire=86400&HW-CC-Sign=213E032773F6CC01DC9984C581E89A9E6061B23956EA47004BB05550D4051483 "点击放大")
    
3.  选择要生成Getters和Setters的字段，点击OK，快速生成。
    
    ![](https://contentcenter-vali-drcn.dbankcdn.cn/pvt_2/DeveloperAlliance_scene_100_1/e4/v3/meG7FuIKSKO8f4aY_rdH4A/zh-cn_image_0000002229758761.png?HW-CC-KV=V1&HW-CC-Date=20260612T074650Z&HW-CC-Expire=86400&HW-CC-Sign=3EA46E25F30C839D800EA89522983C78C9F3D477F58445DE054BF10998BCF7CA "点击放大")
    
    ![](https://contentcenter-vali-drcn.dbankcdn.cn/pvt_2/DeveloperAlliance_scene_100_1/2a/v3/VLeu1MpjSPqSqnXmihWe1A/zh-cn_image_0000002194158892.png?HW-CC-KV=V1&HW-CC-Date=20260612T074650Z&HW-CC-Expire=86400&HW-CC-Sign=D78BDC47D8A48EB0C5386E28327CDBA30A8567A2EAA6A8329B727E713D34F038 "点击放大")