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
大江戸Ruby会議でデータベース クライアントの話をするのは 間違っているだろうか
yahonda
1
120
プロダクションコードにおける encoding/json から encoding/json/v2 へのスムーズな移行
sansantech
PRO
1
410
Context != Context: One window, many lifecycles (AI Native DevCon, Nov 2026)
birgitta410
0
120
The Author Pays
hiccupps
0
190
MCPでAIが自分で調べに行く
cdataj
0
170
JAWSコミュニティに 参加して1年経った結果
ssakita
0
140
AIが会計業務の伴走者に。 マネーフォワード クラウド会計MCPサーバーで実現するAI前提の新しい業務プロセス
nobitabashi
0
110
Frontier Teams — Amazon は AI で「開発のやり方」をどう変えたのか
kmotohas
0
220
AI時代に求められる優秀なTechLeadの振る舞い
pospome
11
16k
ぼくのClaude Codeの使い方
falken
PRO
3
6k
BALLAS Technology Deck
ballas_inc
0
580
bpf_arenaとstruct_opsを使うのが難しかった話
masu_mi
0
230
Featured
See All Featured
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
1
850
Paper Plane
katiecoart
PRO
6
55k
What Being in a Rock Band Can Teach Us About Real World SEO
427marketing
0
1.1k
SEO for Brand Visibility & Recognition
aleyda
0
4.9k
Unlocking the hidden potential of vector embeddings in international SEO
frankvandijk
0
1k
Google's AI Overviews - The New Search
badams
0
1.7k
brightonSEO & MeasureFest 2025 - Winning Strategies for Black Friday CRO & PPC - Christian Goodrich
cargoodrich
3
900
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
360
31k
VelocityConf: Rendering Performance Case Studies
addyosmani
331
25k
Design of three-dimensional binary manipulators for pick-and-place task avoiding obstacles (IECON2024)
konakalab
0
660
Applied NLP in the Age of Generative AI
inesmontani
PRO
4
2.6k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
35
2.9k