{"id":217361,"date":"2020-12-02T11:00:02","date_gmt":"2020-12-02T03:00:02","guid":{"rendered":"http:\/\/4563.org\/?p=217361"},"modified":"2020-12-02T11:00:02","modified_gmt":"2020-12-02T03:00:02","slug":"idea-%e6%8f%92%e4%bb%b6%e5%bc%80%e5%8f%91","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=217361","title":{"rendered":"idea \u63d2\u4ef6\u5f00\u53d1"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  idea \u63d2\u4ef6\u5f00\u53d1               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : Aresxue <\/span>  <span><i><\/i> 2<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>idea \u63d2\u4ef6\u5f00\u53d1\u7684\u6587\u6863\u592a\u8d2b\u7620\u4e86\uff0c\u8fd9\u91cc\u60f3\u89e3\u6790 BeanUtils.copyproperties \u8fd9\u6837\u7684\u5c5e\u6027 copy \u7684\u5b57\u6bb5\u7684\u5f15\u7528\uff0c\u5927\u81f4\u5c31\u662f\u70b9\u51fb\u5b57\u6bb5\u7136\u540e\u5c55\u793a copy \u6216\u8005\u88ab copy \u7684\u5730\u65b9\uff0c\u73b0\u5728\u9047\u5230\u74f6\u9888\u4e86\uff0c\u5c31\u662f\u6211\u62ff\u5230\u8fd9\u4e2a\u5b57\u6bb5\u6240\u5728\u7684\u7c7b PsiClass \u548c BeanUtils.copyproperties \u8fd9\u4e2a\u65b9\u6cd5\u7684 PsiReference \u540e\u4e0d\u77e5\u9053\u600e\u4e48\u628a\u8fd9\u4e24\u4e2a\u7ed3\u5408\u5728\u4e00\u8d77\uff0c\u6709\u61c2\u7684\u670b\u53cb\u8bf7\u5e2e\u52a9<\/p>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>4<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"4418998\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : retanoj <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6211\u89c9\u5f97\u6211\u80fd\u89e3\u51b3\uff0c\u56e0\u4e3a\u6211\u5199\u4e86\u4e2a<br \/>https:\/\/plugins.jetbrains.com\/plugin\/15120-momo-code-sec-inspector-java-<\/p>\n<p>\u4f46\u662f\u6211\u5b9e\u5728\u6ca1\u770b\u61c2\u4e3b\u7684\u63cf\u8ff0\u9700\u6c42                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4418999\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : Aresxue <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @retanoj \u90a3\u5c31\u7eaf\u7cb9\u9700\u6c42\u63cf\u8ff0\uff0c\u73b0\u5728\u4ee3\u7801\u91cc\u6709\u5f88\u591a BeanUtils.copyproperties \uff08\u6216\u5176\u4ed6\u7684\uff09\u5c5e\u6027 copy \u64cd\u4f5c\uff0c\u4f46\u5bf9\u4e8e\u8fd9\u79cd copy \u70b9\u51fb idea \u4e2d\u7684 field\uff0c\u662f\u65e0\u6cd5\u5c55\u793a\u8be5\u5b57\u6bb5\u7684 usages \u7684\uff0c\u5728\u67e5\u770b\u4ee3\u7801\u65f6\u53d8\u91cf\u7684\u4fee\u6539\u5c31\u975e\u5e38\u96be\u4ee5\u8ffd\u8e2a\uff0c\u73b0\u5728\u6211\u60f3\u5b8c\u6210\u4e00\u4e2a\u63d2\u4ef6\u70b9\u51fb field \u5c31\u5c55\u793a BeanUtils.copyproperties \u7684\u5730\u65b9\uff0c\u4e4b\u524d\u7684\u5b9e\u73b0\u601d\u8def\u662f\u6309\u7167 java \u53cd\u5c04\u90a3\u5957\u601d\u8def\u6765\u7684\uff08\u83b7\u53d6 field \u6240\u5728 Class\uff0c\u627e\u5230\u8be5 class \u7684\u5bf9\u8c61\uff0c \u5f53\u8fd9\u4e2a\u5bf9\u8c61\u88ab BeanUtils.copyproperties \u65f6\uff0c\u5047\u8bbe\u662f source\uff0c\u5c31\u83b7\u53d6 target \u7684 class\uff0c\u5728\u90a3\u4e2a class \u4e2d\u6309\u7167 field \u7684 name \u548c type \u5bfb\u627e\uff0c\u627e\u5230\u4e86\u5c31\u8bf4\u660e\u5339\u914d\u4e0a\u4e86\uff0c\u8fd9\u4e2a BeanUtils.copyproperties \u5c31\u88ab\u5c55\u73b0\u51fa\u6765\uff09                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4419000\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : retanoj <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @Aresxue <br \/>\u542c\u8d77\u6765\u53ef\u884c\uff0c\u4f46\u5e94\u8be5\u9700\u8981\u591a\u6b21\u5e94\u7528 Usages of \u67e5\u8be2<br \/>1. \u4ece field \u627e\u5230\u5f53\u524d PsiClass<br \/>2. \u4ece\u5f53\u524d PsiClass \u8c03\u7528 Usages of \u627e\u5230\u4f7f\u7528\u70b9\uff08\u5e94\u8be5\u662f\u627e New Instance creation \u5427\uff09<br \/>3. \u4ece New Instance \u5728 PsiNewXXXX \u4e0a\u62ff\u5230\u53d8\u91cf\u540d\u79f0\uff08\u6216\u8005 Reference \uff1f\uff09<br \/>4. \u4ece\u8fd9\u4e2a Reference \u8c03\u7528 Usages of \u627e\u5230 BeanUtils.copyProperties()\u4f7f\u7528\u70b9<br \/>5. \u5982\u679c\u4e3a source\uff0c\u5219\u62ff\u5230 dest \u7684\u53d8\u91cf PsiReference<br \/>6. \u4ece dest \u7684 PsiReference \u80fd\u627e\u5230\u53d8\u91cf\u5b9a\u4e49\u70b9\uff0c\u63a5\u4e0b\u6765\u5c31\u518d\u770b\u600e\u4e48\u7528\u4e86<\/p>\n<p>Usages of \u8fd9\u4e2a\u529f\u80fd\u5e94\u8be5\u4e0e FindUsagesManager \u548c FindUsagesHandler \u6709\u5173\uff0c\u5177\u4f53\u7528\u6cd5\u8fd8\u5f97\u518d\u770b\u4e0b                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4419001\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : retanoj <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @Aresxue <br \/>Usages of \u7684\u7528\u6cd5\uff0c\u6211\u7b80\u5355\u8bd5\u4e86\u4e00\u4e0b\uff0c\u4ec5\u4f9b\u53c2\u8003<br \/>&#8220;`<br \/>PsiLocalVariable localVariable; \/\/ \u5047\u5982\u8981\u4ece\u4e00\u4e2a localVariable \u5f00\u59cb\u627e<\/p>\n<p>FindUsagesHandler handler =<br \/> JavaFindUsagesHandlerFactory.getInstance(project).createFindUsagesHandler(localVariable, false);<\/p>\n<p>Collection&lt;PsiReference&gt; referenceCollection = <br \/> handler.findReferencesToHighlight(localVariable, localVariable.getUseScope());<br \/>&#8220;`                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>idea \u63d2\u4ef6\u5f00\u53d1 \u8cc7\u6df1\u5927\u4f6c : &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/217361"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=217361"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/217361\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=217361"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=217361"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=217361"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}