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
More Decks by kaiinui
See All by kaiinui
Black Magic in Java
kaiinui
1
640
API開発自動化と量産
kaiinui
1
480
Other Decks in Technology
See All in Technology
今こそ知りたいAmplifyGen2
mkdev10
2
160
Execution in the Kingdom of Agents: Reflections on Abstraction and Complexity
bcantrill
0
940
ai_cording_with_k8s_knowledge.pdf
mochizuki875
1
340
UniFi(ユニファイ)AIカメラの現場活用
ludicmind
1
420
分析の民主化を支えるメタデータ整備の実践
kakehashi
PRO
4
1.3k
DGX Spark でどこまでハッキングができるのか?
kash1064
0
790
WasmをRustにする
sansantech
PRO
0
170
無理せず続ける、子育てエンジニアの学び
codmoninc
PRO
0
690
FOSS4Gを活用した自治体業務DXの試み
470715
0
150
Running Kotlin + Quarkus with Lambda
nealle
1
440
12 個 Tool と、 4,096 Token
hlum
0
130
「事実」を「計測」して、「解釈」する 〜AWS Lambdaのメモリ最適解の見つけ方〜
maimyyym
0
140
Featured
See All Featured
Fireside Chat
paigeccino
43
4.1k
How GitHub (no longer) Works
holman
316
150k
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
1
620
Documentation Writing (for coders)
carmenintech
77
5.6k
Making Projects Easy
brettharned
120
6.8k
Gemini Prompt Engineering: Practical Techniques for Tangible AI Outcomes
mfonobong
2
580
Digital Ethics as a Driver of Design Innovation
axbom
PRO
1
450
Data-driven link building: lessons from a $708K investment (BrightonSEO talk)
szymonslowik
1
1.4k
How to build an LLM SEO readiness audit: a practical framework
nmsamuel
2
940
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
530
It's Worth the Effort
3n
188
29k
The Hidden Cost of Media on the Web [PixelPalooza 2025]
tammyeverts
2
520
Transcript
†黒魔術† @_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 をまず使おう (▰╹◡╹▰) 最後に