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.5k
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.2k
iOSアプリの技術的負債をどう返済したか / How to repay the technical debt of iOS app
kobakei
2
890
iOSアプリ内で不正なSSL証明書を検知する / SSL Pinning for iOS apps
kobakei
34
11k
Kyashアプリ開発の現場
kobakei
4
2.6k
Review of Google I/O 2017 & Prepare for Google I/O 2018
kobakei
0
300
APIクライアントをCodableで置き換えた話
kobakei
0
1.4k
開発者が知っておきたい通知の歴史
kobakei
9
7.3k
mockito-kotlin
kobakei
1
500
2017年に新規アプリを立ち上げた話
kobakei
2
1k
Other Decks in Programming
See All in Programming
Kotlin 2.0 and Beyond
antonarhipov
2
150
大公開!iOS開発の悩みトップ5 〜iOSDC Japan 2024〜
ryunakayama
0
190
Patched fetch did not work
quramy
4
380
React + TextAliveでカッコいいLyric Applicatioinを作ろう!!
tosuri13
0
400
僕が思い描くTypeScriptの未来を勝手に先取りする
yukukotani
9
2.4k
エンジニア1年目で複雑なコードの改善に取り組んだ話
mtnmr
3
2k
unique パッケージから学ぶ interning と weak reference @ Asakusa.go#3
karamaru
2
810
メモリ最適化を究める!iOSアプリ開発における5つの重要なポイント
yhirakawa333
0
420
REXML改善のその後
naitoh
0
190
Rubyのobject_id
qnighy
6
1.3k
Understand the mechanism! Let's do screenshots tests of Compose Previews with various variations / 仕組みから理解する!Composeプレビューを様々なバリエーションでスクリーンショットテストしよう
sumio
3
790
開発を加速する共有Swift Package実践
elmetal
PRO
0
420
Featured
See All Featured
How STYLIGHT went responsive
nonsquared
93
5.1k
Web development in the modern age
philhawksworth
205
10k
Navigating Team Friction
lara
183
13k
Making the Leap to Tech Lead
cromwellryan
128
8.8k
Design by the Numbers
sachag
277
19k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
24
610
Robots, Beer and Maslow
schacon
PRO
157
8.2k
Product Roadmaps are Hard
iamctodd
PRO
48
10k
RailsConf 2023
tenderlove
28
810
StorybookのUI Testing Handbookを読んだ
zakiyama
26
5.1k
Teambox: Starting and Learning
jrom
131
8.7k
Mobile First: as difficult as doing things right
swwweet
221
8.8k
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!