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.6k
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
7.4k
iOSアプリの技術的負債をどう返済したか / How to repay the technical debt of iOS app
kobakei
2
950
iOSアプリ内で不正なSSL証明書を検知する / SSL Pinning for iOS apps
kobakei
34
11k
Kyashアプリ開発の現場
kobakei
4
2.8k
Review of Google I/O 2017 & Prepare for Google I/O 2018
kobakei
0
310
APIクライアントをCodableで置き換えた話
kobakei
0
1.5k
開発者が知っておきたい通知の歴史
kobakei
9
7.6k
mockito-kotlin
kobakei
1
520
2017年に新規アプリを立ち上げた話
kobakei
2
1.1k
Other Decks in Programming
See All in Programming
Designing Your Organization's Test Pyramid ( #scrumniigata )
teyamagu
PRO
5
1.3k
バイラテラルアップサンプリング
fadis
3
430
SwiftDataのカスタムデータストアを試してみた
1mash0
0
150
ComposeでのPicture in Picture
takathemax
0
130
大LLM時代にこの先生きのこるには-ITエンジニア編
fumiyakume
8
3.3k
読書シェア会 vol.4 『ダイナミックリチーミング 第2版』
kotaro666
0
110
VibeCoding時代のエンジニアリング
daisuketakeda
0
140
LRパーサーはいいぞ
ydah
6
1.2k
ニーリーQAのこれまでとこれから
nealle
2
760
実践Webフロントパフォーマンスチューニング
cp20
45
10k
Thank you <💅>, What's the Next?
ahoxa
1
600
Rubyの!メソッドをちゃんと理解する
alstrocrack
1
240
Featured
See All Featured
Agile that works and the tools we love
rasmusluckow
329
21k
Fireside Chat
paigeccino
37
3.4k
It's Worth the Effort
3n
184
28k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
Statistics for Hackers
jakevdp
799
220k
How GitHub (no longer) Works
holman
314
140k
Embracing the Ebb and Flow
colly
85
4.7k
We Have a Design System, Now What?
morganepeng
52
7.6k
Building Applications with DynamoDB
mza
94
6.4k
VelocityConf: Rendering Performance Case Studies
addyosmani
329
24k
A designer walks into a library…
pauljervisheath
205
24k
For a Future-Friendly Web
brad_frost
177
9.7k
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!