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
作って終わりじゃないサーバーレス 〜9年運用する大規模EC物流API基盤の設計・運用のリアル〜
zozotech
PRO
0
430
バイブコーディング時代のWebアプリ開発入門~Cloud Runで学ぶセキュアなビルドとデプロイ
waiwai2111
1
140
Issue 駆動でスペシャリストの意図を届ける、AI 実装のアクセシビリティ向上
thkt
0
130
フルカイテン株式会社 エンジニア向け採用資料
fullkaiten
0
12k
なぜ「決定性」が 決定的に重要なのか? Durable Execution 基盤の数理的理解 #serverlessjp / ServerlessDays Tokyo 2026
ytaka23
3
1.1k
ScotSecure West 2026 - Glasgow
raybugg
0
150
負債のメタファと2026年 / Debt Metaphor in Agentic Engineering Age 202609 Edition
twada
PRO
10
5k
AI de Idea
kawaguti
PRO
2
130
株式会社シーエーシー エンジニア向け会社紹介資料
cac
0
57k
AI coding 整合正規方法
philipz
0
480
SREは、MCPとAutopilotをこう使え!
kazumax55
3
950
AI時代の「技術的負債」の変質ー概念の終焉と再解釈、エージェントと共に向かう先
nwiizo
1
3.1k
Featured
See All Featured
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
50
10k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
35
2.6k
Marketing to machines
jonoalderson
1
5.8k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
1.6k
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
11
1k
Art, The Web, and Tiny UX
lynnandtonic
304
22k
Speed Design
sergeychernyshev
33
2.1k
Measuring & Analyzing Core Web Vitals
bluesmoon
9
1k
Typedesign – Prime Four
hannesfritz
42
3.2k
Mobile First: as difficult as doing things right
swwweet
225
10k
Navigating Team Friction
lara
192
16k
Darren the Foodie - Storyboard
khoart
PRO
4
3.9k
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 をまず使おう (▰╹◡╹▰) 最後に