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
絵ではじめるKubernetesセキュリティ
aoi1
4
680
AIで社員の自主発信に広報目線を組み込む
_mossann_t
0
130
【技術的負債conf】事業成長に伴う技術的負債の説明責任とAIによるモニタリング、認知的負債について
i35_267
3
1.8k
株式会社シーエーシー エンジニア向け会社紹介資料
cac
0
57k
The Knowledge Spine: A Machine-Executable Ontology for Governed Marketing Activation
vananth22
0
110
その Lambda、8分で 管理者権限まで奪われます
k1nakayama
6
3.1k
サーバーレスをどこまで使う? WebRTC対戦ゲームで選んだVPSとの共存設計
kaidouji85
0
110
AIに任せた品質は、誰が見立てるのか - AI時代のテストマネジメント
nakanao
3
2.3k
AI時代、データエンジニアが一番おもろい
genshun9
0
670
なぜ「決定性」が 決定的に重要なのか? Durable Execution 基盤の数理的理解 #serverlessjp / ServerlessDays Tokyo 2026
ytaka23
3
780
Cloudflare Workers 向けアプリを C# で構築する ~WASM Native AOT への道~
nenonaninu
1
470
CLIライブラリ開発を支える技術
htnabe
0
130
Featured
See All Featured
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
330
First, design no harm
axbom
PRO
2
1.3k
Building a Modern Day E-commerce SEO Strategy
aleyda
45
9.2k
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
890
Stop Working from a Prison Cell
hatefulcrawdad
274
21k
The Pragmatic Product Professional
lauravandoore
37
7.4k
The Curious Case for Waylosing
cassininazir
1
510
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.5k
A Guide to Academic Writing Using Generative AI - A Workshop
ks91
PRO
1
470
We Have a Design System, Now What?
morganepeng
55
8.3k
SEOcharity - Dark patterns in SEO and UX: How to avoid them and build a more ethical web
sarafernandez
0
280
What's in a price? How to price your products and services
michaelherold
247
13k
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 をまず使おう (▰╹◡╹▰) 最後に