Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
†黒魔術† と Annotation と AspectJ
Search
kaiinui
August 23, 2014
Technology
1.2k
3
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
†黒魔術† と Annotation と AspectJ
Annotation と AspectJ で楽しい黒魔術 (▰╹◡╹▰)
kaiinui
August 23, 2014
Transcript
29 slides
†黒魔術† @_kaiinui
=
結論から? (▰╹◡╹▰)
@PotatoTip をつけるだけでトースト
Java の黒魔術: Annotation
Java の黒魔術: Annotation どうみても黒魔術
Java の黒魔術: Annotation Annotation as a code?
良さ? ・宣言的さ ・コードと「宣言」を分離出来る ・コードが短くなったり ・ミスを防止したり(@Nullable)
・ButterKnife の @InjectView ・Support Annotation の @NonNull ・AndroidAnnotations の @UiThread
・Rails の has_many 「する」と「である」を分ける
良い例: ButterKnife の @InjectView
する textView = (TextView) findViewById(R.id.text); である @InjectView(R.id.text) textView;
する runOnUiThread(new Runnable {...}); である @UiThread public void showToast() {..};
さて
Bring your own Annotation!
ツール • AspectJ • java.lang.annotation
初級編 Annotation を普通に使う(AspectJ じゃない)
1. Annotation をつくる(カンタン)
2. 黒魔術
3. 出来た
4. 完成 BananaKnife
中級編 AspectJ でアスペクトを織り込む
1. Annotation をつくる(カンタン)
2. AspectJ で黒魔術
@PotatoTip をつけるだけでトースト
AspectJ の良い例: Hugo
AspectJ の良い例: Hugo あまりに便利なので iOS 版もつくった kaiinui/KILogInjector
一言で? ・Annotation で @Hoge がついたメソッド、フィー ルド、クラスとかを弄れたりする ・AspectJ で処理をフックしてほげほげ、といった 処理がカンタンに書ける。 (▰╹◡╹▰)
きみだけのさいきょう @Annotation をつくろう!
「モデルと API 辛い」周りの話がしたかった あと自分で作るとかどうでもいいので既にある Annotation をまず使おう (▰╹◡╹▰) 最後に
More Decks by kaiinui
See All by kaiinui
Black Magic in Java
kaiinui
1
650
API開発自動化と量産
kaiinui
1
480
Other Decks in Technology
See All in Technology
AI時代に求められる優秀なTechLeadの振る舞い
pospome
11
16k
SREのためのFinOps入門
muziyoshiz
3
1.5k
JAWSコミュニティに 参加して1年経った結果
ssakita
0
140
あの日、見つかっていなかったらどうなっていたか
kazzpapa3
2
160
GCASアップデート(202607-202610)
techniczna
1
320
81天的 AI Agent 軟體開發團隊治理實務分享
regionbbs
0
160
高品質と高スピードを支える品質のシフトレフトのアプローチ
goyoki
2
680
Oracle Base Database Service 技術詳細
oracle4engineer
PRO
17
120k
AI時代における医療情報システムのセキュリティ / Security of Healthcare IT Systems in the AI Era
henryofficial
0
160
アラートを見直していたら営業組織への理解にちょっとだけ繋がった話
z63d
1
190
Shared Signals Framework 仕様解説
oidfj
0
420
小さなエージェントから始めてみよう!実践コンテキストエンジニアリング
iwamot
PRO
0
110
Featured
See All Featured
Why You Should Never Use an ORM
jnunemaker
PRO
61
10k
Reality Check: Gamification 10 Years Later
codingconduct
0
2.4k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
250
1.3M
Ruling the World: When Life Gets Gamed
codingconduct
0
440
Producing Creativity
orderedlist
PRO
348
41k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
31
3.4k
The Cost Of JavaScript in 2023
addyosmani
56
10k
First, design no harm
axbom
PRO
2
1.4k
コードの90%をAIが書く世界で何が待っているのか / What awaits us in a world where 90% of the code is written by AI
rkaga
63
48k
Utilizing Notion as your number one productivity tool
mfonobong
4
640
Imperfection Machines: The Place of Print at Facebook
scottboms
270
14k
Designing for Timeless Needs
cassininazir
1
560