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
Asynchronous Injection
Search
funnelbit
June 22, 2016
Technology
290
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Asynchronous Injection
funnelbit
June 22, 2016
More Decks by funnelbit
See All by funnelbit
Hatena Engineer Seminar #9
funnelbit
5
7.5k
droidkaigi-2017-renovation
funnelbit
10
11k
Dart
funnelbit
0
300
BottomBarAndSnackBar
funnelbit
0
540
Dagger2 Optional bindings
funnelbit
0
610
WearableRecyclerView
funnelbit
1
840
QucikSettingsTileAPI
funnelbit
0
380
Mobile Vision
funnelbit
0
490
AwarenessAPI
funnelbit
0
160
Other Decks in Technology
See All in Technology
起点・思考・出力で分解する 〜PM業務の自動化設計〜
kazu_kichi_67
1
1.1k
データレイクの「見えない問題」を可視化する
sansantech
PRO
1
200
現場のトークンマネジメント
dak2
1
190
10年間のブログ発信を振り返って見えたWebアプリケーションエンジニアとしての軌跡
stefafafan
0
190
Flow 不死:AI 時代 DevOps 的不變本質
cheng_wei_chen
2
520
AIが自律的に回る開発ループを設計してチーム開発に組み込む
nekorush14
0
130
「ビジネスがわかるエンジニア」とは何か?
ryooob
0
320
自宅LLMの話
jacopen
1
720
元銀行員がAIだけでアプリを量産!「バイブコーディング実演セミナー 」
tatsuya1970
0
110
フルカイテン株式会社 エンジニア向け採用資料
fullkaiten
0
11k
Kiro Ambassador を目指す話
k_adachi_01
0
130
AIペネトレーションテスト・ セキュリティ検証「AgenticSec」紹介資料
laysakura
2
7.6k
Featured
See All Featured
Utilizing Notion as your number one productivity tool
mfonobong
4
330
A Tale of Four Properties
chriscoyier
163
24k
Building the Perfect Custom Keyboard
takai
2
800
Making the Leap to Tech Lead
cromwellryan
135
9.9k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.8k
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
150
Chasing Engaging Ingredients in Design
codingconduct
0
230
The State of eCommerce SEO: How to Win in Today's Products SERPs - #SEOweek
aleyda
2
11k
Code Review Best Practice
trishagee
74
20k
How to Align SEO within the Product Triangle To Get Buy-In & Support - #RIMC
aleyda
2
1.6k
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
620
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Transcript
"TZODISPOPVT*OKFDUJPO JEGVOOFMCJU
ࣗݾհ ଜྋ )BUFOBGVOOFMCJU 5XJUUFS!FYQFSPQFSP
None
"OESPJE Ͱ ඇಉظ ʹ ґଘղܾ͢Δ
%BHHFS 1SPEVDFST w ඇಉظͰґଘղܾ͢ΔΈΛఏڙ
؆୯ͳྫ w .PEVMFº w $PNQPOFOU w "DUJWJUZ
.PEVMF @ProducerModule final class AppProducerModule { @Produces ListenableFuture<UserData> getUserData() {
// ~ ͳΜ͔ΊͬͪΌ͕͔͔࣌ؒΔॲཧ ~ return Futures.immediateFuture(new UserData("userName")); } @Produces String userName(UserData userData) { return userData.name; // Activity ͜Ε͕΄͍͠ }
.PEVMF @ProducerModule final class AppProducerModule { @Produces ListenableFuture<UserData> getUserData() {
// 1 // ~ ͳΜ͔ΊͬͪΌ͕͔͔࣌ؒΔॲཧ ~ return Futures.immediateFuture(new UserData("userName")); } @Produces String userName(UserData userData) { // 2 return userData.name; // Activity ͜Ε͕΄͍͠ }
.PEVMF @Module public class ExecutorModule { @Provides @Production static Executor
executor() { return Executors.newCachedThreadPool(); } }
$PNQPOFOU @ProductionComponent(modules = { ExecutorModule.class, AppProducerModule.class}) public interface AppProducerComponent {
ListenableFuture<String> userName(); }
"DUJWJUZ … ListenableFuture<String> userDataListenableFuture = DaggerAppProducerComponent.create().userName(); Futures.addCallback( userDataListenableFuture, new FutureCallback<String>()
{ @Override public void onSuccess(String result) { Log.e("name", result); } @Override public void onFailure(Throwable t) { Log.e("failure", t.toString()); } }); …
1SPEVDFS5
.PEVMF @ProducerModule public class AppProducerLazyModule { @Produces @Normal ListenableFuture<UserData> provideNUserData()
{ return Futures.immediateFuture(new UserData("normal")); } @Produces @Special ListenableFuture<UserData> provideSUserData() { return Futures.immediateFuture(new UserData("special")); } @Produces ListenableFuture<UserData> provideUserData( @Normal Producer<UserData> nProducer, @Special Producer<UserData> sProducer) { return sProducer.get(); } }
@ProducerModule public class MyModule { @Produces ListenableFuture<A> a() { …
} @Produces ListenableFuture<B> b(A a) { … } @Produces ListenableFuture<C> c(B b) { … } @Produces @Delayed ListenableFuture<C> delayedC(A a, Producer<C> c) { … return c.get(); } }
@ProducerModule public class MyModule { @Produces ListenableFuture<A> a() { …
} // 1 @Produces ListenableFuture<B> b(A a) { … } // 3 @Produces ListenableFuture<C> c(B b) { … } // 4 @Produces @Delayed ListenableFuture<C> delayedC(A a, Producer<C> c) { … return c.get(); } // 2 }
1SPEVDFE5
.PEVMF @ProducerModule final class AppProducerModule { @Produces ListenableFuture<UserData> getUserData() {
// ~ ͳΜ͔ΊͬͪΌ͕͔͔࣌ؒΔॲཧ ~ throw new IllegalStateException(); // Θ͟ͱམͱ͢ } @Produces String userName(Produced<UserData> userData) { try { return userData.get().name; } catch (ExecutionException e) { e.printStackTrace(); return "Կ͔͕ى͖ͨ"; } } }
ৄࡉ w IUUQHPPHMFHJUIVCJPEBHHFSQSPEVDFST
͋Γ͕ͱ͏͍͟͝·ͨ͠