Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
†黒魔術† と Annotation と AspectJ
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
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
630
API開発自動化と量産
kaiinui
1
470
Other Decks in Technology
See All in Technology
攻撃と防御で学ぶAI時代のプロダクトセキュリティ演習
recruitengineers
PRO
9
2.5k
ブラウザ研修 2026
recruitengineers
PRO
6
920
個人OSSが、机の上から世界に広がるまでの話
shinyasaita
1
380
トヨタ⽣産⽅式(TPS)⼊⾨
recruitengineers
PRO
3
720
【CEDEC2026】専門性の高いデフォルメチームが挑んだ人材育成戦略 〜Cygames Academiaの企画から実施まで〜
cygames
PRO
0
560
今こそ聞きたいソフトウェア設計 ドメイン駆動設計再入門
masuda220
PRO
17
7.1k
Agent 時代の Kaggle 展望 / kaggle-in-the-agentic-era
upura
1
700
つくって納得、つかって実感! 大規模言語モデルことはじめ ver2.0
recruitengineers
PRO
4
1.5k
Eight Engineering Unit 紹介資料
sansan33
PRO
3
8.2k
Invisible to AI? Making TYPO3 Sites Quotable by AI Search Systems
wolfgangwagner
0
190
サイバー捜査員研修(後半)
nomizone
1
850
社内の7割が使うデータ基盤を、 データチーム2人で回すためにやったこと
koh_yoshi
4
1.3k
Featured
See All Featured
How to Think Like a Performance Engineer
csswizardry
28
2.7k
YesSQL, Process and Tooling at Scale
rocio
174
15k
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
1
260
What's in a price? How to price your products and services
michaelherold
247
13k
Digital Ethics as a Driver of Design Innovation
axbom
PRO
1
360
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
5
1.2k
New Earth Scene 8
popppiees
3
2.5k
Leveraging LLMs for student feedback in introductory data science courses - posit::conf(2025)
minecr
1
340
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
Leading Effective Engineering Teams in the AI Era
addyosmani
9
2.3k
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
1
270
Data-driven link building: lessons from a $708K investment (BrightonSEO talk)
szymonslowik
1
1.2k
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 をまず使おう (▰╹◡╹▰) 最後に