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
Modern Java Libraries with Kotlin
Search
Keisuke Kobayashi
May 24, 2017
Programming
0
1.4k
Modern Java Libraries with Kotlin
potatotips #40
Keisuke Kobayashi
May 24, 2017
Tweet
Share
More Decks by Keisuke Kobayashi
See All by Keisuke Kobayashi
今日から始める依存性の注入 / First Time Dependency Injection
kobakei
26
7k
iOSアプリの技術的負債をどう返済したか / How to repay the technical debt of iOS app
kobakei
2
850
iOSアプリ内で不正なSSL証明書を検知する / SSL Pinning for iOS apps
kobakei
34
10k
Kyashアプリ開発の現場
kobakei
4
2.5k
Review of Google I/O 2017 & Prepare for Google I/O 2018
kobakei
0
290
APIクライアントをCodableで置き換えた話
kobakei
0
1.4k
開発者が知っておきたい通知の歴史
kobakei
10
7.2k
mockito-kotlin
kobakei
1
480
2017年に新規アプリを立ち上げた話
kobakei
2
980
Other Decks in Programming
See All in Programming
Azure OpenAI Serviceのプロンプトエンジニアリング入門
tomokusaba
3
680
ADRを一年運用してみた/adr_after_a_year
hanhan1978
7
2.4k
What We Can Learn From OSS
inouehi
0
420
MicrosoftのPlatform Engineeringガイドを読んで実際になにかやってみた
ymd65536
1
310
ONE WEDGE_company_guide
1wedge_one
0
470
ゆるい個人開発のススメ
kuroppe1819
10
990
サイコロで理解する統計的仮説検定の考え方
tatamiya
4
920
雑に思考を整理する技術と効能
konifar
58
29k
AWS Application Composerで始める、 サーバーレスなデータ基盤構築 / 20240406-jawsug-hokuriku-shinkansen
kasacchiful
1
260
OpenAPIを中心に考えるAPI開発入門 / Introduction to API Development with a Focus on OpenAPI
seike460
PRO
2
170
二郎系ラーメンのコールで学ぶ AST 解析
memory1994
PRO
7
1.7k
PostmanでAPIの動作確認が楽になった話
h455h1
0
170
Featured
See All Featured
Embracing the Ebb and Flow
colly
80
4.1k
Designing Experiences People Love
moore
136
23k
Web Components: a chance to create the future
zenorocha
305
41k
How to Ace a Technical Interview
jacobian
272
22k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
227
16k
Designing with Data
zakiwarfel
96
4.8k
Practical Orchestrator
shlominoach
182
9.7k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
14
1.5k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
226
51k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
21
1.6k
GitHub's CSS Performance
jonrohan
1025
450k
No one is an island. Learnings from fostering a developers community.
thoeni
16
2.1k
Transcript
Modern Java Libraries with Kotlin Keisuke Kobayashi / @kobakei potatotips
#40
About me • Keisuke Kobayashi • GitHub, Qiita: @kobakei •
Twitter: @kobakei122 • Kyash, Inc
None
ࠓ͢͜ͱ • ݪଇJavaϥΠϒϥϦKotlinͰ େମͦͷ··͑·͢ • Ұ෦ಛผʹରԠ͕ඞཁͳͷΛհ͠·͢
Dagger2 + Orma
Dagger2 + Orma • kaptͰࣗಈੜ͞ΕΔΫϥεDaggerͰ provideͰ͖ͳ͍ • ͭ·ΓOrmaDatabase
NG: Ϗϧυ͕௨Βͳ͍ @Module class AppModule(private val context: Context) { @Singleton
@Provides fun provideOrmaDatabase(context: Context): OrmaDatabase { return OrmaDatabase.builder(context).build() } }
ղܾࡦ • OrmaDatabaseΛϥοϓ͢Δ͚ͩͷΫϥεΛ ࡞ͬͯɺͦΕΛprovide͢Δ
OrmaHolder class OrmaHolder(val context: Context) { val ormaDatabase = OrmaDatabase.builder(context).build()
}
Dagger Module @Module class AppModule(private val context: Context) { @Singleton
@Provides fun provideOrmaHolder(context: Context): OrmaHolder { return OrmaHolder(context) } }
Data Binding
Data binding • dependenciesʹkaptͰՃ android { dataBinding { enabled true
} } dependencies { kapt 'com.android.databinding:compiler:x.y.z' }
Parceler
Parceler • ParcelableͷϘΠϥʔϓϨʔτΛࣗಈੜ͢Δ ϥΠϒϥϦ • data classͰParcelerΛ͍͍ͨ
data class • toString, hasCodeͷ࣮ෆཁ data class User ( val
email: String?, val userName: String?, )
data class with Parceler • ͜Εͩͱಈ͔ͳ͍ʢϓϩύςΟ͋Δ͕ϑΟʔϧυ Ͱͳ͍ͨΊʣ @Parcel data class
User ( val email: String?, val userName: String?, )
data class with Parceler • ͜ΕͰϓϩύςΟܦ༝ͰಡΈॻ͖ͯ͘͠ΕΔ @Parcel(Parcel.Serialization.BEAN) data class User
@ParcelConstructor constructor( val email: String?, val userName: String?, )
͓·͚: αϯϓϧॻ͖·ͨ͠ • https://github.com/kobakei/Android-Kotlin- Example
Thanks!