68
68
69
69
70
70
71
- < meta name ="keywords " content ="Hexo, NexT ">
71
+ < meta name ="keywords " content ="annotation、processor、自动生成java文件, ">
72
72
73
73
74
74
79
79
80
80
81
81
82
- < meta name ="description " content ="1234title: 安卓注解处理器-processordate: 2019-01-04 19:02:34tags: annotation、processor、自动生成java文件category: 注解 最近在学习安卓开源框架发现,很多的开源框架都使用到了注解处理器,例如EventBus3.0。本文通过一个简单的Demo来介绍如何使用注解处理器。Demo链接为https://github.com ">
83
- < meta name ="keywords " content ="Android ">
82
+ < meta name ="description " content ="最近在学习安卓开源框架发现,很多的开源框架都使用到了注解处理器,例如EventBus3.0。本文通过一个简单的Demo来介绍如何使用注解处理器。Demo链接为https://github.com/cugyong/AnnotationProcessor-sample ,如果喜欢的话,欢迎大家给star。 ">
83
+ < meta name ="keywords " content ="annotation、processor、自动生成java文件 ">
84
84
< meta property ="og:type " content ="article ">
85
- < meta property ="og:title " content ="夏勇的个人博客 ">
85
+ < meta property ="og:title " content ="安卓注解处理器-processor ">
86
86
< meta property ="og:url " content ="http://yoursite.com/2019/01/04/安卓注解处理器-processor/index.html ">
87
87
< meta property ="og:site_name " content ="夏勇的个人博客 ">
88
- < meta property ="og:description " content ="1234title: 安卓注解处理器-processordate: 2019-01-04 19:02:34tags: annotation、processor、自动生成java文件category: 注解 最近在学习安卓开源框架发现,很多的开源框架都使用到了注解处理器,例如EventBus3.0。本文通过一个简单的Demo来介绍如何使用注解处理器。Demo链接为https://github.com ">
88
+ < meta property ="og:description " content ="最近在学习安卓开源框架发现,很多的开源框架都使用到了注解处理器,例如EventBus3.0。本文通过一个简单的Demo来介绍如何使用注解处理器。Demo链接为https://github.com/cugyong/AnnotationProcessor-sample ,如果喜欢的话,欢迎大家给star。 ">
89
89
< meta property ="og:locale " content ="zh-Hans ">
90
- < meta property ="og:image " content ="http://yoursite.com/2019/01/04/安卓注解处理器-processor/框架流程 .png ">
91
- < meta property ="og:image " content ="http://yoursite.com/2019/01/04/安卓注解处理器-processor/annotation.png ">
92
- < meta property ="og:updated_time " content ="2019-01-04T11:11:19.343Z ">
90
+ < meta property ="og:image " content ="http://yoursite.com/2019/01/04/安卓注解处理器-processor/D:/blog/source/_posts/%E5%AE%89%E5%8D%93%E6%B3%A8%E8%A7%A3%E5%A4%84%E7%90%86%E5%99%A8-processor/%E6%A1%86%E6%9E%B6%E6%B5%81%E7%A8%8B .png ">
91
+ < meta property ="og:image " content ="http://yoursite.com/2019/01/04/安卓注解处理器-processor/D:/blog/source/_posts/%E5%AE%89%E5%8D%93%E6%B3%A8%E8%A7%A3%E5%A4%84%E7%90%86%E5%99%A8-processor/ annotation.png ">
92
+ < meta property ="og:updated_time " content ="2019-01-04T11:15:21.602Z ">
93
93
< meta name ="twitter:card " content ="summary ">
94
- < meta name ="twitter:title " content ="夏勇的个人博客 ">
95
- < meta name ="twitter:description " content ="1234title: 安卓注解处理器-processordate: 2019-01-04 19:02:34tags: annotation、processor、自动生成java文件category: 注解 最近在学习安卓开源框架发现,很多的开源框架都使用到了注解处理器,例如EventBus3.0。本文通过一个简单的Demo来介绍如何使用注解处理器。Demo链接为https://github.com ">
96
- < meta name ="twitter:image " content ="http://yoursite.com/2019/01/04/安卓注解处理器-processor/框架流程 .png ">
94
+ < meta name ="twitter:title " content ="安卓注解处理器-processor ">
95
+ < meta name ="twitter:description " content ="最近在学习安卓开源框架发现,很多的开源框架都使用到了注解处理器,例如EventBus3.0。本文通过一个简单的Demo来介绍如何使用注解处理器。Demo链接为https://github.com/cugyong/AnnotationProcessor-sample ,如果喜欢的话,欢迎大家给star。 ">
96
+ < meta name ="twitter:image " content ="http://yoursite.com/2019/01/04/安卓注解处理器-processor/D:/blog/source/_posts/%E5%AE%89%E5%8D%93%E6%B3%A8%E8%A7%A3%E5%A4%84%E7%90%86%E5%99%A8-processor/%E6%A1%86%E6%9E%B6%E6%B5%81%E7%A8%8B .png ">
97
97
98
98
99
99
129
129
130
130
131
131
132
- < title > | 夏勇的个人博客</ title >
132
+ < title > 安卓注解处理器-processor | 夏勇的个人博客</ title >
133
133
134
134
135
135
315
315
316
316
317
317
318
- < h1 class ="post-title " itemprop ="name headline "> </ h1 >
318
+ < h1 class ="post-title " itemprop ="name headline "> 安卓注解处理器-processor </ h1 >
319
319
320
320
321
321
< div class ="post-meta ">
@@ -327,7 +327,7 @@ <h1 class="post-title" itemprop="name headline"></h1>
327
327
328
328
< span class ="post-meta-item-text "> 发表于</ span >
329
329
330
- < time title ="创建于 " itemprop ="dateCreated datePublished " datetime ="2019-01-04T18:29:09 +08:00 ">
330
+ < time title ="创建于 " itemprop ="dateCreated datePublished " datetime ="2019-01-04T19:12:12 +08:00 ">
331
331
2019-01-04
332
332
</ time >
333
333
@@ -338,6 +338,28 @@ <h1 class="post-title" itemprop="name headline"></h1>
338
338
</ span >
339
339
340
340
341
+ < span class ="post-category ">
342
+
343
+ < span class ="post-meta-divider "> |</ span >
344
+
345
+ < span class ="post-meta-item-icon ">
346
+ < i class ="fa fa-folder-o "> </ i >
347
+ </ span >
348
+
349
+ < span class ="post-meta-item-text "> 分类于</ span >
350
+
351
+
352
+ < span itemprop ="about " itemscope ="" itemtype ="http://schema.org/Thing ">
353
+ < a href ="/categories/注解/ " itemprop ="url " rel ="index ">
354
+ < span itemprop ="name "> 注解</ span >
355
+ </ a >
356
+ </ span >
357
+
358
+
359
+
360
+
361
+ </ span >
362
+
341
363
342
364
343
365
@@ -370,10 +392,9 @@ <h1 class="post-title" itemprop="name headline"></h1>
370
392
371
393
372
394
373
- < figure class ="highlight plain "> < table > < tr > < td class ="gutter "> < pre > < span class ="line "> 1</ span > < br > < span class ="line "> 2</ span > < br > < span class ="line "> 3</ span > < br > < span class ="line "> 4</ span > < br > </ pre > </ td > < td class ="code "> < pre > < span class ="line "> title: 安卓注解处理器-processor</ span > < br > < span class ="line "> date: 2019-01-04 19:02:34</ span > < br > < span class ="line "> tags: annotation、processor、自动生成java文件</ span > < br > < span class ="line "> category: 注解</ span > < br > </ pre > </ td > </ tr > </ table > </ figure >
374
- < p > 最近在学习安卓开源框架发现,很多的开源框架都使用到了注解处理器,例如EventBus3.0。本文通过一个简单的Demo来介绍如何使用注解处理器。Demo链接为< a href ="https://github.com/cugyong/AnnotationProcessor-sample " target ="_blank " rel ="noopener "> https://github.com/cugyong/AnnotationProcessor-sample</ a > ,如果喜欢的话,欢迎大家给star。< a id ="more "> </ a > </ p >
395
+ < p > 最近在学习安卓开源框架发现,很多的开源框架都使用到了注解处理器,例如EventBus3.0。本文通过一个简单的Demo来介绍如何使用注解处理器。Demo链接为< a href ="https://github.com/cugyong/AnnotationProcessor-sample " target ="_blank " rel ="noopener "> https://github.com/cugyong/AnnotationProcessor-sample</ a > ,如果喜欢的话,欢迎大家给star。< a id ="more "> </ a > </ p >
375
396
< h2 id ="Demo需求描述 "> < a href ="#Demo需求描述 " class ="headerlink " title ="Demo需求描述 "> </ a > Demo需求描述</ h2 > < p > 用户通过执行一个传入参数为A(类对象)的静态方法,该方法会最终把参数A中加了特定注解的所有方法执行一遍。</ p >
376
- < h2 id ="需求实现 "> < a href ="#需求实现 " class ="headerlink " title ="需求实现 "> </ a > 需求实现</ h2 > < p > < img src ="/2019/01/04/安卓注解处理器-processor/框架流程 .png " alt ="框架流程 "> </ p >
397
+ < h2 id ="需求实现 "> < a href ="#需求实现 " class ="headerlink " title ="需求实现 "> </ a > 需求实现</ h2 > < p > < img src ="/2019/01/04/安卓注解处理器-processor/D:/blog/source/_posts/%E5%AE%89%E5%8D%93%E6%B3%A8%E8%A7%A3%E5%A4%84%E7%90%86%E5%99%A8-processor/%E6%A1%86%E6%9E%B6%E6%B5%81%E7%A8%8B .png " alt ="框架流程 "> </ p >
377
398
< p > 整个项目分为四个部分:</ p >
378
399
< ul >
379
400
< li > 注解–要使用的注解类型,这部分通常也可以放在lib中;</ li >
@@ -383,7 +404,7 @@ <h2 id="需求实现"><a href="#需求实现" class="headerlink" title="需求
383
404
</ ul >
384
405
< p > 首先新建一个安卓工程,点击运行展示的是hello world。</ p >
385
406
< h3 id ="注解 "> < a href ="#注解 " class ="headerlink " title ="注解 "> </ a > 注解</ h3 > < p > 在上述工程中new->Module->Java Library,新建一个Java Library Module,命名为annotation。在该Module下创建一个文件AnnotationTest.java,</ p >
386
- < p > < img src ="/2019/01/04/安卓注解处理器-processor/annotation.png " alt ="1546591844724 "> </ p >
407
+ < p > < img src ="/2019/01/04/安卓注解处理器-processor/D:/blog/source/_posts/%E5%AE%89%E5%8D%93%E6%B3%A8%E8%A7%A3%E5%A4%84%E7%90%86%E5%99%A8-processor/ annotation.png " alt ="1546591844724 "> </ p >
387
408
< p > AnnotationTest.java里面代码如下:</ p >
388
409
< figure class ="highlight plain "> < table > < tr > < td class ="gutter "> < pre > < span class ="line "> 1</ span > < br > < span class ="line "> 2</ span > < br > < span class ="line "> 3</ span > < br > < span class ="line "> 4</ span > < br > < span class ="line "> 5</ span > < br > </ pre > </ td > < td class ="code "> < pre > < span class ="line "> @Retention(RetentionPolicy.CLASS)</ span > < br > < span class ="line "> @Target(ElementType.METHOD)</ span > < br > < span class ="line "> public @interface AnnotationTest {</ span > < br > < span class ="line "> String name() default "test";</ span > < br > < span class ="line "> }</ span > < br > </ pre > </ td > </ tr > </ table > </ figure >
389
410
< p > 1、注解@Retention按生命周期来划分可分为3类:</ p >
@@ -429,27 +450,17 @@ <h3 id="Lib"><a href="#Lib" class="headerlink" title="Lib"></a>Lib</h3><p>在工
429
450
430
451
< footer class ="post-footer ">
431
452
432
-
453
+ < div class ="post-tags ">
454
+
455
+ < a href ="/tags/annotation、processor、自动生成java文件/ " rel ="tag "> # annotation、processor、自动生成java文件</ a >
456
+
457
+ </ div >
433
458
459
+
434
460
435
461
436
-
437
462
438
- < div class ="post-nav ">
439
- < div class ="post-nav-next post-nav-item ">
440
-
441
- </ div >
442
463
443
- < span class ="post-nav-divider "> </ span >
444
-
445
- < div class ="post-nav-prev post-nav-item ">
446
-
447
- < a href ="/2019/01/04/test/ " rel ="prev " title ="test ">
448
- test < i class ="fa fa-chevron-right "> </ i >
449
- </ a >
450
-
451
- </ div >
452
- </ div >
453
464
454
465
455
466
@@ -525,15 +536,33 @@ <h3 id="Lib"><a href="#Lib" class="headerlink" title="Lib"></a>Lib</h3><p>在工
525
536
526
537
< a href ="/archives/ ">
527
538
528
- < span class ="site-state-item-count "> 2 </ span >
539
+ < span class ="site-state-item-count "> 1 </ span >
529
540
< span class ="site-state-item-name "> 日志</ span >
530
541
</ a >
531
542
</ div >
532
543
533
544
534
545
546
+
547
+
548
+ < div class ="site-state-item site-state-categories ">
549
+
550
+ < span class ="site-state-item-count "> 1</ span >
551
+ < span class ="site-state-item-name "> 分类</ span >
552
+
553
+ </ div >
554
+
535
555
536
556
557
+
558
+
559
+ < div class ="site-state-item site-state-tags ">
560
+
561
+ < span class ="site-state-item-count "> 1</ span >
562
+ < span class ="site-state-item-name "> 标签</ span >
563
+
564
+ </ div >
565
+
537
566
538
567
</ nav >
539
568
0 commit comments