{"id":4141,"date":"2021-11-29T16:40:15","date_gmt":"2021-11-29T08:40:15","guid":{"rendered":"http:\/\/123.57.164.21\/?p=4141"},"modified":"2021-11-30T17:36:16","modified_gmt":"2021-11-30T09:36:16","slug":"lombok%e4%bb%8b%e7%bb%8d%e5%8f%8a%e4%bd%bf%e7%94%a8%e6%96%b9%e6%b3%95","status":"publish","type":"post","link":"https:\/\/92it.top\/?p=4141","title":{"rendered":"Lombok\u4ecb\u7ecd\u53ca\u4f7f\u7528\u65b9\u6cd5"},"content":{"rendered":"\n<h5 class=\"wp-block-heading\">1. lombok\u7b80\u4ecb<\/h5>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>\u5728\u5199Java\u7a0b\u5e8f\u7684\u65f6\u5019\u7ecf\u5e38\u4f1a\u9047\u5230\u5982\u4e0b\u60c5\u5f62\uff1a\u65b0\u5efa\u4e86\u4e00\u4e2aClass\u7c7b\uff0c\u7136\u540e\u5728\u5176\u4e2d\u8bbe\u7f6e\u4e86\u51e0\u4e2a\u5b57\u6bb5\uff0c\u6700\u540e\u8fd8\u9700\u8981\u82b1\u8d39\u5f88\u591a\u65f6\u95f4\u6765\u5efa\u7acbgetter\uff0csetter\u65b9\u6cd5\u8fd8\u6709\u6784\u9020\u51fd\u6570\u7b49 \u3002lombok\u9879\u76ee\u7684\u4ea7\u751f\u5c31\u662f\u4e3a\u4e86\u7701\u53bb\u6211\u4eec\u624b\u52a8\u521b\u5efagetter\u548csetter\u65b9\u6cd5\u7684\u9ebb\u70e6\uff0c\u5b83\u80fd\u591f\u5728\u6211\u4eec\u7f16\u8bd1\u6e90\u7801\u7684\u65f6\u5019\u81ea\u52a8\u5e2e\u6211\u4eec\u751f\u6210getter\u548csetter\u65b9\u6cd5\u3002\u5373\u5b83\u6700\u7ec8\u80fd\u591f\u8fbe\u5230\u7684\u6548\u679c\u662f\uff1a\u5728\u6e90\u7801\u4e2d\u6ca1\u6709getter\u548csetter\u65b9\u6cd5\uff0c\u4f46\u662f\u5728\u7f16\u8bd1\u751f\u6210\u7684\u5b57\u8282\u7801\u6587\u4ef6\u4e2d\u6709getter\u548csetter\u65b9\u6cd5<\/p><p><\/p><\/blockquote>\n\n\n\n<h5 class=\"wp-block-heading\">2. \u5b89\u88c5<\/h5>\n\n\n\n<ul><li>2.1 Maven\u6dfb\u52a0\u4f9d\u8d56\uff0clombok\u4e5f\u5c31\u662f\u4e00\u4e2a\u666e\u901a\u7684jar\u5305<\/li><\/ul>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;dependency>\n            &lt;groupId>org.projectlombok&lt;\/groupId>\n            &lt;artifactId>lombok&lt;\/artifactId>\n            &lt;version>1.16.14&lt;\/version>\n            &lt;scope>provided&lt;\/scope>\n        &lt;\/dependency>&lt;em>&lt;\/em><\/pre>\n\n\n\n<ul><li>2.2 eclipse\u5b89\u88c5<\/li><\/ul>\n\n\n\n<ul><li>1.\u4ece\u5b98\u7f51\u4e0b\u8f7dlombok.jar(https:\/\/projectlombok.org\/download-edge), \u4e0b\u8f7d\u5230mac\u7684\u76ee\u5f55\u4e0a\u3002<\/li><\/ul>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/123.57.164.21\/wp-content\/uploads\/2021\/11\/image-89-1024x578.png\" alt=\"\" class=\"wp-image-4183\" width=\"560\" height=\"316\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2021\/11\/image-89-1024x578.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2021\/11\/image-89-300x169.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2021\/11\/image-89-768x434.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2021\/11\/image-89-1536x867.png 1536w, https:\/\/92it.top\/wp-content\/uploads\/2021\/11\/image-89-830x469.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2021\/11\/image-89-230x130.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2021\/11\/image-89-350x198.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2021\/11\/image-89-480x271.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2021\/11\/image-89.png 1998w\" sizes=\"(max-width: 560px) 100vw, 560px\" \/><\/figure><\/div>\n\n\n\n<ul><li>CD\u5230lombok.jar\u4e0b\u8f7d\u76ee\u5f55\uff0c\u7ec8\u7aef\u4e0b\u8fd0\u884c<span class=\"has-inline-color has-vivid-red-color\">java -jar lombok.jar<\/span>\u547d\u4ee4<\/li><\/ul>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/123.57.164.21\/wp-content\/uploads\/2021\/11\/image-94.png\" alt=\"\" class=\"wp-image-4189\" width=\"557\" height=\"35\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2021\/11\/image-94.png 980w, https:\/\/92it.top\/wp-content\/uploads\/2021\/11\/image-94-300x19.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2021\/11\/image-94-768x49.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2021\/11\/image-94-830x53.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2021\/11\/image-94-230x15.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2021\/11\/image-94-350x22.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2021\/11\/image-94-480x30.png 480w\" sizes=\"(max-width: 557px) 100vw, 557px\" \/><\/figure><\/div>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/123.57.164.21\/wp-content\/uploads\/2021\/11\/image-90-1024x597.png\" alt=\"\" class=\"wp-image-4184\" width=\"520\" height=\"303\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2021\/11\/image-90-1024x597.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2021\/11\/image-90-300x175.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2021\/11\/image-90-768x448.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2021\/11\/image-90-1536x896.png 1536w, https:\/\/92it.top\/wp-content\/uploads\/2021\/11\/image-90-830x484.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2021\/11\/image-90-230x134.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2021\/11\/image-90-350x204.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2021\/11\/image-90-480x280.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2021\/11\/image-90.png 1674w\" sizes=\"(max-width: 520px) 100vw, 520px\" \/><\/figure><\/div>\n\n\n\n<ul><li>\u70b9\u51fbSpecify location\uff0c\u5f39\u51fa\u7684\u5bf9\u8bdd\u6846\uff0c\u9009\u62e9Eclipse.ini\u6587\u4ef6\u3002<\/li><\/ul>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/123.57.164.21\/wp-content\/uploads\/2021\/11\/image-92-1024x576.png\" alt=\"\" class=\"wp-image-4186\" width=\"590\" height=\"331\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2021\/11\/image-92-1024x576.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2021\/11\/image-92-300x169.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2021\/11\/image-92-768x432.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2021\/11\/image-92-1536x865.png 1536w, https:\/\/92it.top\/wp-content\/uploads\/2021\/11\/image-92-830x467.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2021\/11\/image-92-230x129.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2021\/11\/image-92-350x197.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2021\/11\/image-92-480x270.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2021\/11\/image-92.png 1588w\" sizes=\"(max-width: 590px) 100vw, 590px\" \/><\/figure><\/div>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/123.57.164.21\/wp-content\/uploads\/2021\/11\/image-93-1024x577.png\" alt=\"\" class=\"wp-image-4187\" width=\"584\" height=\"329\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2021\/11\/image-93-1024x577.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2021\/11\/image-93-300x169.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2021\/11\/image-93-768x433.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2021\/11\/image-93-1536x865.png 1536w, https:\/\/92it.top\/wp-content\/uploads\/2021\/11\/image-93-830x468.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2021\/11\/image-93-230x130.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2021\/11\/image-93-350x197.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2021\/11\/image-93-480x270.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2021\/11\/image-93.png 1576w\" sizes=\"(max-width: 584px) 100vw, 584px\" \/><\/figure><\/div>\n\n\n\n<ul><li><span style=\"color: initial; font-family: -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Roboto, Oxygen-Sans, Ubuntu, Cantarell, &quot;Helvetica Neue&quot;, sans-serif;\">3.\u70b9\u51fbInstall\/Update<\/span><\/li><li>4.\u91cd\u542feclipse\uff0clombok\u5373\u53ef\u751f\u6548<\/li><li>5.\u6253\u5f00eclipse.ini\u53ef\u4ee5\u770b\u5230\u6700\u4e0b\u9762\u8ffd\u52a0\u4e00\u884c\u914d\u7f6e\uff08-javaagent:\/Applications\/SpringToolSuite4.app\/Contents\/Eclipse\/lombok.jar\uff09<\/li><\/ul>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">-startup\n..\/Eclipse\/plugins\/org.eclipse.equinox.launcher_1.6.300.v20210813-1054.jar\n--launcher.library\n..\/Eclipse\/plugins\/org.eclipse.equinox.launcher.cocoa.macosx.x86_64_1.2.300.v20210828-0802\n-product\norg.springframework.boot.ide.branding.sts4\n--launcher.defaultAction\nopenFile\n-vm\n..\/Eclipse\/plugins\/org.eclipse.justj.openjdk.hotspot.jre.full.macosx.x86_64_17.0.0.v20211012-1059\/jre\/lib\/libjli.dylib\n-vmargs\n-Dosgi.requiredJavaVersion=11\n-Dosgi.dataAreaRequiresExplicitInit=true\n-Xms256m\n-Xmx2048m\n--illegal-access=permit\n--add-modules=ALL-SYSTEM\n-XstartOnFirstThread\n-Dorg.eclipse.swt.internal.carbon.smallFonts\n-Xdock:icon=..\/Resources\/sts4.icns\n-javaagent:\/Applications\/SpringToolSuite4.app\/Contents\/Eclipse\/lombok.jar\n<\/pre>\n\n\n\n<h5 class=\"wp-block-heading\">3. lombok\u4f7f\u7528<\/h5>\n\n\n\n<ul><li>3.1&nbsp;<code>@NonNull<\/code>: \u53ef\u4ee5\u5e2e\u52a9\u6211\u4eec\u907f\u514d\u7a7a\u6307\u9488\u3002<\/li><\/ul>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">package io.fredia.femicro.gate.ratelimit.config;\n\nimport io.micrometer.core.lang.NonNull;\n\n\/**\n * LombokDemo\n * \n * @author : Fredia\n * @since : 2018\u5e744\u670811\u65e5\n * @version : v1.0.0\n *\/\npublic class LombokDemoClass {\n\n    public void NonNullDemo(@NonNull Object obj) {\n\n    }\n}\n&lt;em>&lt;\/em><\/pre>\n\n\n\n<ul><li>3.2 @Cleanup: \u81ea\u52a8\u5e2e\u6211\u4eec\u8c03\u7528close()\u65b9\u6cd5\u3002<\/li><\/ul>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">package io.fredia.femicro.gate.ratelimit.config;\n\nimport java.io.FileInputStream;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.OutputStream;\n\nimport lombok.Cleanup;\n\n\/**\n * LombokDemo\n * \n * @author : Fredia\n * @since : 2018\u5e744\u670811\u65e5\n * @version : v1.0.0\n *\/\npublic class LombokDemoClass {\n\n    public static void main(String[] args) throws IOException {\n        @Cleanup\n        InputStream in = new FileInputStream(args[0]);\n        @Cleanup\n        OutputStream out = new FileOutputStream(args[1]);\n        byte[] b = new byte[10000];\n        while (true) {\n            int r = in.read(b);\n            if (r == -1)\n                break;\n            out.write(b, 0, r);\n        }\n    }\n}<\/pre>\n\n\n\n<p>\u6211\u4eec\u90fd\u77e5\u9053io\u64cd\u4f5c\u5b8c\u5fc5\u987b\u5173\u95ed\uff0c\u6240\u4ee5\u6b64\u6ce8\u89e3\u5e2e\u6211\u4eec\u5b8c\u6210\u4e86\u5982\u4e0b\u7684\u64cd\u4f5c\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">  in.close();\n  out.close();<\/pre>\n\n\n\n<ul><li>3.3&nbsp;<code>@Getter \/ @Setter<\/code>: \u81ea\u52a8\u751f\u6210Getter\/Setter\u65b9\u6cd5<\/li><\/ul>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">package io.fredia.femicro.gate.ratelimit.config;\n\nimport java.util.Date;\n\nimport lombok.Getter;\nimport lombok.Setter;\n\n\/**\n * LombokDemo\n * \n * @author : Fredia\n * @since : 2018\u5e744\u670811\u65e5\n * @version : v1.0.0\n *\/\npublic class LombokDemo {\n\n    @Getter\n    @Setter\n    private String key;\n    @Getter\n    @Setter\n    private Date expiration;\n\n}&lt;em>&lt;\/em><\/pre>\n\n\n\n<ul><li>3.4 @NoArgsConstructor: \u81ea\u52a8\u751f\u6210\u65e0\u53c2\u6570\u6784\u9020\u51fd\u6570\u3002<\/li><\/ul>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">import lombok.NoArgsConstructor;\n\n\/**\n * LombokDemo\n * \n * @author : Fredia\n * @since : 2018\u5e744\u670811\u65e5\n * @version : v1.0.0\n *\/\n@NoArgsConstructor\npublic class LombokDemo {\n\n    private String key;\n    private Long remaining;\n    private Long reset;\n    private Date expiration;\n\n    public static void main(String[] args) {\n            LombokDemo lom2 = new LombokDemo();\n    }\n}<\/pre>\n\n\n\n<ul><li>3.5 @AllArgsConstructor: \u81ea\u52a8\u751f\u6210\u5168\u53c2\u6570\u6784\u9020\u51fd\u6570\u3002<\/li><\/ul>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">import lombok.AllArgsConstructor;\n\/**\n * LombokDemo\n * \n * @author : Fredia\n * @since : 2018\u5e744\u670811\u65e5\n * @version : v1.0.0\n *\/\n@AllArgsConstructor\npublic class LombokDemo {\n\n    private String key;\n    private Long remaining;\n    private Long reset;\n    private Date expiration;\n\n    public static void main(String[] args) {\n        LombokDemo lom = new LombokDemo(key, remaining, reset, expiration);\n    }\n}<\/pre>\n\n\n\n<ul><li>3.6 @Data: \u81ea\u52a8\u4e3a\u6240\u6709\u5b57\u6bb5\u6dfb\u52a0@ToString, @EqualsAndHashCode, @Getter\u65b9\u6cd5\uff0c\u4e3a\u975efinal\u5b57\u6bb5\u6dfb\u52a0@Setter,\u548c@RequiredArgsConstructor@RequiredArgsConstructor<\/li><\/ul>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">import java.util.Date;\nimport lombok.AllArgsConstructor;\nimport lombok.Data;\nimport lombok.NoArgsConstructor;\n\/**\n * LombokDemo\n * \n * @author : Fredia\n * @since : 2018\u5e744\u670811\u65e5\n * @version : v1.0.0\n *\/\n@Data\n@NoArgsConstructor\n@AllArgsConstructor\npublic class LombokDemo {\n\n    private String key;\n    private Long remaining;\n    private Long reset;\n    private Date expiration;\n\n}<\/pre>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/123.57.164.21\/wp-content\/uploads\/2021\/11\/image-77-1024x423.png\" alt=\"\" class=\"wp-image-4144\" width=\"568\" height=\"234\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2021\/11\/image-77-1024x423.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2021\/11\/image-77-300x124.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2021\/11\/image-77-768x318.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2021\/11\/image-77-830x343.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2021\/11\/image-77-230x95.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2021\/11\/image-77-350x145.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2021\/11\/image-77-480x198.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2021\/11\/image-77.png 1340w\" sizes=\"(max-width: 568px) 100vw, 568px\" \/><\/figure><\/div>\n\n\n\n<h5 class=\"wp-block-heading\">4. lombok\u5b9e\u73b0\u539f\u7406\u5206\u6790<br><\/h5>\n\n\n\n<p>\u63a5\u4e0b\u6765\u8fdb\u884clombok\u80fd\u591f\u5de5\u4f5c\u7684\u539f\u7406\u5206\u6790\uff0c\u4ee5Oracle\u7684javac\u7f16\u8bd1\u5de5\u5177\u4e3a\u4f8b\u3002<br>\u81ea\u4eceJava 6\u8d77\uff0cjavac\u5c31\u652f\u6301<strong>\u201cJSR 269 Pluggable Annotation Processing API\u201d<\/strong>\u89c4\u8303\uff0c\u53ea\u8981\u7a0b\u5e8f\u5b9e\u73b0\u4e86\u8be5API\uff0c\u5c31\u80fd\u5728javac\u8fd0\u884c\u7684\u65f6\u5019\u5f97\u5230\u8c03\u7528\u3002<br>\u4e3e\u4f8b\u6765\u8bf4\uff0c\u73b0\u5728\u6709\u4e00\u4e2a\u5b9e\u73b0\u4e86<strong>\u201dJSR 269 API\u201d<\/strong>\u7684\u7a0b\u5e8fA,\u90a3\u4e48\u4f7f\u7528javac\u7f16\u8bd1\u6e90\u7801\u7684\u65f6\u5019\u5177\u4f53\u6d41\u7a0b\u5982\u4e0b:<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>javac\u5bf9\u6e90\u4ee3\u7801\u8fdb\u884c\u5206\u6790\uff0c\u751f\u6210\u4e00\u68f5**\u62bd\u8c61\u8bed\u6cd5\u6811(AST) **<br>\u8fd0\u884c\u8fc7\u7a0b\u4e2d\u8c03\u7528\u5b9e\u73b0\u4e86\u201dJSR 269 API\u201d\u7684A\u7a0b\u5e8f<br>\u6b64\u65f6A\u7a0b\u5e8f\u5c31\u53ef\u4ee5\u5b8c\u6210\u5b83\u81ea\u5df1\u7684\u903b\u8f91\uff0c\u5305\u62ec\u4fee\u6539\u7b2c\u4e00\u6b65\u9aa4\u5f97\u5230\u7684\u62bd\u8c61\u8bed\u6cd5\u6811(AST)<br>javac\u4f7f\u7528\u4fee\u6539\u540e\u7684\u62bd\u8c61\u8bed\u6cd5\u6811(AST)\u751f\u6210\u5b57\u8282\u7801\u6587\u4ef6<\/p><\/blockquote>\n\n\n\n<p>\u6240\u4ee5lombok\u672c\u8d28\u4e0a\u5c31\u662f\u8fd9\u6837\u7684\u4e00\u4e2a\u5b9e\u73b0\u4e86<strong>\u201dJSR 269 API\u201d<\/strong>\u7684\u7a0b\u5e8f\u3002\u5728\u4f7f\u7528javac\u7684\u8fc7\u7a0b\u4e2d\uff0c\u7ed3\u5408\u5b98\u65b9\u8bf4\u660e\uff0c\u5b83\u7f16\u8bd1\u7684\u6d41\u7a0b\u5982\u4e0b\uff1a<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>javac\u5bf9\u6e90\u4ee3\u7801\u8fdb\u884c\u5206\u6790\uff0c\u751f\u6210\u4e00\u68f5<strong>\u62bd\u8c61\u8bed\u6cd5\u6811(AST)<\/strong>**<br>\u8fd0\u884c\u8fc7\u7a0b\u4e2d\u8c03\u7528\u5b9e\u73b0\u4e86\u201dJSR 269 API\u201d\u7684lombok\u7a0b\u5e8f<br>\u6b64\u65f6lombok\u5c31\u5bf9\u7b2c\u4e00\u6b65\u9aa4\u5f97\u5230\u7684AST\u8fdb\u884c\u5904\u7406\uff0c\u627e\u5230@Data\u6ce8\u89e3\u6240\u5728\u7c7b\u5bf9\u5e94\u7684\u8bed\u6cd5\u6811(AST)\uff0c\u7136\u540e\u4fee\u6539\u8be5\u8bed\u6cd5\u6811(AST)\uff0c\u589e\u52a0getter\u548csetter\u65b9\u6cd5\u5b9a\u4e49\u7684\u76f8\u5e94\u6811\u8282\u70b9<br>javac\u4f7f\u7528\u4fee\u6539\u540e\u7684\u62bd\u8c61\u8bed\u6cd5\u6811(AST)\u751f\u6210\u5b57\u8282\u7801\u6587\u4ef6<\/p><\/blockquote>\n\n\n\n<h5 class=\"wp-block-heading\">5. \u603b\u7ed3<br><\/h5>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">lombok\u7684\u5b9e\u73b0\uff1a\u5c31\u662f\u5143\u6ce8\u89e3\u51fa\u73b0\u540e\u6ce8\u89e3\u8fd0\u884c\u751f\u547d\u5468\u671f\u91cc\u9762\u7684\u7f16\u8bd1\u5468\u671f\uff0c\u8fd9\u4e2a\u5c31\u662f JSR 269 Pluggable Annotation Processing API\uff0c\u5c31\u662f\u6e90\u4ee3\u7801\u5728\u7f16\u8bd1\u6210\u5b57\u8282\u7801\u7684\u65f6\u5019\u4fee\u6539\u4e86\u8bed\u6cd5\u6811\u7684\u8282\u70b9\u89c4\u5219\u8fdb\u884c\u4e86\u52a0\u5f3a\u751f\u6210\uff0c\n\u4ee5\u540e\u53ef\u4ee5\u66f4\u52a0\u5feb\u6377\u7684\u6572\u4ee3\u7801\u4e86\u3002<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>1. lombok\u7b80\u4ecb \u5728\u5199Java\u7a0b\u5e8f\u7684\u65f6\u5019\u7ecf\u5e38\u4f1a\u9047\u5230\u5982\u4e0b\u60c5\u5f62\uff1a\u65b0\u5efa\u4e86\u4e00\u4e2aClass\u7c7b\uff0c\u7136\u540e\u5728\u5176\u4e2d\u8bbe\u7f6e\u4e86\u51e0\u4e2a [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[26],"tags":[],"_links":{"self":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/4141"}],"collection":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4141"}],"version-history":[{"count":6,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/4141\/revisions"}],"predecessor-version":[{"id":4192,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/4141\/revisions\/4192"}],"wp:attachment":[{"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4141"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4141"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4141"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}