Skip to content

Commit e948a2c

Browse files
committed
Site updated: 2019-01-04 19:15:57
1 parent 68a6119 commit e948a2c

File tree

11 files changed

+1233
-413
lines changed

11 files changed

+1233
-413
lines changed

2019/01/04/安卓注解处理器-processor/index.html

Lines changed: 64 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868

6969

7070

71-
<meta name="keywords" content="Hexo, NexT">
71+
<meta name="keywords" content="annotation、processor、自动生成java文件,">
7272

7373

7474

@@ -79,21 +79,21 @@
7979

8080

8181

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文件">
8484
<meta property="og:type" content="article">
85-
<meta property="og:title" content="夏勇的个人博客">
85+
<meta property="og:title" content="安卓注解处理器-processor">
8686
<meta property="og:url" content="http://yoursite.com/2019/01/04/安卓注解处理器-processor/index.html">
8787
<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。">
8989
<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">
9393
<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">
9797

9898

9999

@@ -129,7 +129,7 @@
129129

130130

131131

132-
<title> | 夏勇的个人博客</title>
132+
<title>安卓注解处理器-processor | 夏勇的个人博客</title>
133133

134134

135135

@@ -315,7 +315,7 @@
315315

316316

317317

318-
<h1 class="post-title" itemprop="name headline"></h1>
318+
<h1 class="post-title" itemprop="name headline">安卓注解处理器-processor</h1>
319319

320320

321321
<div class="post-meta">
@@ -327,7 +327,7 @@ <h1 class="post-title" itemprop="name headline"></h1>
327327

328328
<span class="post-meta-item-text">发表于</span>
329329

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">
331331
2019-01-04
332332
</time>
333333

@@ -338,6 +338,28 @@ <h1 class="post-title" itemprop="name headline"></h1>
338338
</span>
339339

340340

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+
341363

342364

343365

@@ -370,10 +392,9 @@ <h1 class="post-title" itemprop="name headline"></h1>
370392

371393

372394

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>
375396
<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>
377398
<p>整个项目分为四个部分:</p>
378399
<ul>
379400
<li>注解–要使用的注解类型,这部分通常也可以放在lib中;</li>
@@ -383,7 +404,7 @@ <h2 id="需求实现"><a href="#需求实现" class="headerlink" title="需求
383404
</ul>
384405
<p>首先新建一个安卓工程,点击运行展示的是hello world。</p>
385406
<h3 id="注解"><a href="#注解" class="headerlink" title="注解"></a>注解</h3><p>在上述工程中new-&gt;Module-&gt;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>
387408
<p>AnnotationTest.java里面代码如下:</p>
388409
<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 &#123;</span><br><span class="line"> String name() default &quot;test&quot;;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
389410
<p>1、注解@Retention按生命周期来划分可分为3类:</p>
@@ -429,27 +450,17 @@ <h3 id="Lib"><a href="#Lib" class="headerlink" title="Lib"></a>Lib</h3><p>在工
429450

430451
<footer class="post-footer">
431452

432-
453+
<div class="post-tags">
454+
455+
<a href="/tags/annotation、processor、自动生成java文件/" rel="tag"># annotation、processor、自动生成java文件</a>
456+
457+
</div>
433458

459+
434460

435461

436-
437462

438-
<div class="post-nav">
439-
<div class="post-nav-next post-nav-item">
440-
441-
</div>
442463

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>
453464

454465

455466

@@ -525,15 +536,33 @@ <h3 id="Lib"><a href="#Lib" class="headerlink" title="Lib"></a>Lib</h3><p>在工
525536

526537
<a href="/archives/">
527538

528-
<span class="site-state-item-count">2</span>
539+
<span class="site-state-item-count">1</span>
529540
<span class="site-state-item-name">日志</span>
530541
</a>
531542
</div>
532543

533544

534545

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+
535555

536556

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+
537566

538567
</nav>
539568

about/index.html

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,15 +360,33 @@ <h1 class="post-title" itemprop="name headline">这是cugyong的个人博客</h1
360360

361361
<a href="/archives/">
362362

363-
<span class="site-state-item-count">2</span>
363+
<span class="site-state-item-count">1</span>
364364
<span class="site-state-item-name">日志</span>
365365
</a>
366366
</div>
367367

368368

369369

370+
371+
372+
<div class="site-state-item site-state-categories">
373+
374+
<span class="site-state-item-count">1</span>
375+
<span class="site-state-item-name">分类</span>
376+
377+
</div>
378+
370379

371380

381+
382+
383+
<div class="site-state-item site-state-tags">
384+
385+
<span class="site-state-item-count">1</span>
386+
<span class="site-state-item-name">标签</span>
387+
388+
</div>
389+
372390

373391
</nav>
374392

archives/2019/01/index.html

Lines changed: 22 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@
293293

294294

295295

296-
嗯..! 目前共计 2 篇日志。 继续努力。
296+
嗯..! 目前共计 1 篇日志。 继续努力。
297297
</span>
298298

299299

@@ -312,56 +312,21 @@ <h1 class="archive-year" id="archive-year-2019">2019</h1>
312312

313313

314314

315-
<article class="post post-type-normal" itemscope="" itemtype="http://schema.org/Article">
316-
<header class="post-header">
317-
318-
<h2 class="post-title">
319-
320-
<a class="post-title-link" href="/2019/01/04/test/" itemprop="url">
321-
322-
<span itemprop="name">test</span>
323-
324-
</a>
325-
326-
</h2>
327-
328-
<div class="post-meta">
329-
<time class="post-time" itemprop="dateCreated" datetime="2019-01-04T19:12:12+08:00" content="2019-01-04">
330-
01-04
331-
</time>
332-
</div>
333-
334-
</header>
335-
</article>
336-
337-
338-
339-
340-
341-
342-
343-
344-
345-
346-
347-
348-
349-
350315
<article class="post post-type-normal" itemscope="" itemtype="http://schema.org/Article">
351316
<header class="post-header">
352317

353318
<h2 class="post-title">
354319

355320
<a class="post-title-link" href="/2019/01/04/安卓注解处理器-processor/" itemprop="url">
356321

357-
<span itemprop="name">未命名</span>
322+
<span itemprop="name">安卓注解处理器-processor</span>
358323

359324
</a>
360325

361326
</h2>
362327

363328
<div class="post-meta">
364-
<time class="post-time" itemprop="dateCreated" datetime="2019-01-04T18:29:09+08:00" content="2019-01-04">
329+
<time class="post-time" itemprop="dateCreated" datetime="2019-01-04T19:12:12+08:00" content="2019-01-04">
365330
01-04
366331
</time>
367332
</div>
@@ -426,15 +391,33 @@ <h2 class="post-title">
426391

427392
<a href="/archives/">
428393

429-
<span class="site-state-item-count">2</span>
394+
<span class="site-state-item-count">1</span>
430395
<span class="site-state-item-name">日志</span>
431396
</a>
432397
</div>
433398

434399

435400

401+
402+
403+
<div class="site-state-item site-state-categories">
404+
405+
<span class="site-state-item-count">1</span>
406+
<span class="site-state-item-name">分类</span>
407+
408+
</div>
409+
436410

437411

412+
413+
414+
<div class="site-state-item site-state-tags">
415+
416+
<span class="site-state-item-count">1</span>
417+
<span class="site-state-item-name">标签</span>
418+
419+
</div>
420+
438421

439422
</nav>
440423

0 commit comments

Comments
 (0)