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
Protobuf in Kotlin
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
TakuSemba
March 27, 2019
Technology
2k
2
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Protobuf in Kotlin
TakuSemba
March 27, 2019
More Decks by TakuSemba
See All by TakuSemba
Customize & Debug ExoPlayer @droidkaigi 2020
takusemba
0
2.1k
Jetpack Compose
takusemba
3
3.7k
Single Activity with MVVM
takusemba
4
1.4k
KotlinConf Report @ca.kt#7
takusemba
2
500
Request in a QUIC way @shibuya.apk#28
takusemba
2
1.1k
Lint for Kotlin @R.kt#3
takusemba
3
1.6k
Auto Release @potatochips#48
takusemba
1
1.3k
Media streaming on Android @droidkaigi 2018
takusemba
6
8.3k
gRPC on Android @DroidconSF Report
takusemba
1
640
Other Decks in Technology
See All in Technology
OpenTelemetryにおけるGoのゼロコード・コンパイル時計装について #fukuokago
quiver
0
130
GoでCコンパイラを作った話
repunit
0
130
AIレビューはどこまで任せられるのか?自動化と人が背負うレビューの境界
sansantech
PRO
3
1.1k
変更し続けられるシステムをどう保つか — AI時代のSSoTという設計原則
kawauso
1
260
AIコード生成×サプライチェーン攻撃 — PHPが直面する“二重の信頼問題
shinyasaita
0
230
アップデートで何が変わった?デモで学んで使いこなすIBM Bob2.0
muehara
0
180
ガバナンスの「ちょうどいい落とし所」を探れ!開発スピードを妨げない運用判断の勘所 / SRE NEXT 2026
genda
1
260
CIで使うClaude
iwatatomoya
0
290
AI時代の開発生産性を捉え直す — 経営と現場をつなぐ「開発組織のオブザーバビリティ」— / AI Dev Ex Conference 2026
tkyowa
0
190
Webアプリ認証の全体像 / The Big Picture of Web App Authentication
kitano_yuichi
0
240
複数プロダクトで進めるAI機能実装 ── 実践から得たリアルな学びとロードマップ実現への挑戦 / AICon2026_yanari
rakus_dev
0
140
穢れた技術選定について
watany
18
5.7k
Featured
See All Featured
The Curse of the Amulet
leimatthew05
2
13k
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
470
Accessibility Awareness
sabderemane
1
160
A Soul's Torment
seathinner
6
3.1k
Jess Joyce - The Pitfalls of Following Frameworks
techseoconnect
PRO
1
190
Exploring the relationship between traditional SERPs and Gen AI search
raygrieselhuber
PRO
2
4.1k
How to make the Groovebox
asonas
2
2.3k
The Invisible Side of Design
smashingmag
301
52k
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
260
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
360
Navigating Algorithm Shifts & AI Overviews - #SMXNext
aleyda
1
1.4k
Google's AI Overviews - The New Search
badams
0
1.1k
Transcript
None
@takusemba https://github.com/TakuSemba
Protocol Buffers
Json Protocol buffers
None
None
None
None
Wire Clean, lightweight protocol buffers for Android and Java.
syntax = "proto3"; package com.takusemba; option java_package = "com.takusemba.proto"; enum
Size { SMALL = 0; MEDIUM = 1; LARGE = 2; } message Coffee { string name = 1; // espresso double price = 2; // 340 Size size = 3; // small / medium / large bool isAvailable = 4; // true / false }
None
None
data class Coffee( /** * ex) espresso */ @field:WireField(tag =
1, adapter = "com.squareup.wire.ProtoAdapter#STRING") val name: String? = null, /** * ex) 340 */ @field:WireField(tag = 2, adapter = "com.squareup.wire.ProtoAdapter#DOUBLE") val price: Double? = null, /** * ex) small / medium / large */ @field:WireField(tag = 3, adapter = "com.takusemba.proto.Size#ADAPTER") val size: Size? = null, /** * ex) true / false */ @field:WireField(tag = 4, adapter = "com.squareup.wire.ProtoAdapter#BOOL") val isAvailable: Boolean? = null, val unknownFields: ByteString = ByteString.EMPTY ) : Message<Coffee, Coffee.Builder>(ADAPTER, unknownFields) { … }
data class Coffee( /** * ex) espresso */ @field:WireField(tag =
1, adapter = "com.squareup.wire.ProtoAdapter#STRING") val name: String? = null, /** * ex) 340 */ @field:WireField(tag = 2, adapter = "com.squareup.wire.ProtoAdapter#DOUBLE") val price: Double? = null, /** * ex) small / medium / large */ @field:WireField(tag = 3, adapter = "com.takusemba.proto.Size#ADAPTER") val size: Size? = null, /** * ex) true / false */ @field:WireField(tag = 4, adapter = "com.squareup.wire.ProtoAdapter#BOOL") val isAvailable: Boolean? = null, val unknownFields: ByteString = ByteString.EMPTY ) : Message<Coffee, Coffee.Builder>(ADAPTER, unknownFields) { … } val name: String? = null, val price: Double? = null, val size: Size? = null, val isAvailable: Boolean? = null,
data class Coffee( /** * ex) espresso */ @field:WireField(tag =
1, adapter = "com.squareup.wire.ProtoAdapter#STRING") val name: String? = null, /** * ex) 340 */ @field:WireField(tag = 2, adapter = "com.squareup.wire.ProtoAdapter#DOUBLE") val price: Double? = null, /** * ex) small / medium / large */ @field:WireField(tag = 3, adapter = "com.takusemba.proto.Size#ADAPTER") val size: Size? = null, /** * ex) true / false */ @field:WireField(tag = 4, adapter = "com.squareup.wire.ProtoAdapter#BOOL") val isAvailable: Boolean? = null, val unknownFields: ByteString = ByteString.EMPTY ) : Message<Coffee, Coffee.Builder>(ADAPTER, unknownFields) { … } data class Coffee(
--java_interop
--java_interop val coffee = Coffee( name = "espresso", price =
310.0, size = Size.SMALL, isAvailable = true )
--java_interop val coffee = Coffee( name = "espresso", price =
310.0, size = Size.SMALL, isAvailable = true ) val coffee = Coffee.Builder() .name("espresso") .price(310.0) .size(Size.SMALL) .isAvailable(true) .build()
--java_interop val coffee = Coffee( name = "espresso", price =
310.0, size = Size.SMALL, isAvailable = true ) val coffee = Coffee.Builder() .name("espresso") .price(310.0) .size(Size.SMALL) .isAvailable(true) .build() val name: String
--java_interop val coffee = Coffee( name = "espresso", price =
310.0, size = Size.SMALL, isAvailable = true ) val coffee = Coffee.Builder() .name("espresso") .price(310.0) .size(Size.SMALL) .isAvailable(true) .build() val name: String @JvmField val name: String
kotlin nullability
kotlin nullability syntax = "proto3"; package com.takusemba; option java_package =
"com.takusemba.proto"; enum Size { SMALL = 0; MEDIUM = 1; LARGE = 2; } message Coffee { string name = 1; // espresso double price = 2; // 340 Size size = 3; // small / medium / large bool isAvailable = 4; // true / false }
kotlin nullability syntax = "proto3"; package com.takusemba; option java_package =
"com.takusemba.proto"; enum Size { SMALL = 0; MEDIUM = 1; LARGE = 2; } message Coffee { string name = 1; // espresso double price = 2; // 340 Size size = 3; // small / medium / large bool isAvailable = 4; // true / false } syntax = "proto3";
kotlin nullability syntax = “proto2"; package com.takusemba; option java_package =
"com.takusemba.proto"; enum Size { SMALL = 0; MEDIUM = 1; LARGE = 2; } message Coffee { string name = 1; // espresso double price = 2; // 340 Size size = 3; // small / medium / large bool isAvailable = 4; // true / false } syntax = “proto2";
kotlin nullability syntax = “proto2"; package com.takusemba; option java_package =
"com.takusemba.proto"; enum Size { SMALL = 0; MEDIUM = 1; LARGE = 2; } message Coffee { string name = 1; // espresso double price = 2; // 340 Size size = 3; // small / medium / large bool isAvailable = 4; // true / false } message Coffee { string name = 1; // espresso double price = 2; // 340 Size size = 3; // small / medium / large bool isAvailable = 4; // true / false }
kotlin nullability syntax = "proto2"; package com.takusemba; option java_package =
"com.takusemba.proto"; enum Size { SMALL = 0; MEDIUM = 1; LARGE = 2; } message Coffee { required string name = 1; // espresso required double price = 2; // 340 required Size size = 3; // small / medium / large optional bool isAvailable = 4; // true / false } message Coffee { required string name = 1; // espresso required double price = 2; // 340 required Size size = 3; // small / medium / large optional bool isAvailable = 4; // true / false }
kotlin nullability syntax = "proto2"; package com.takusemba; option java_package =
"com.takusemba.proto"; enum Size { SMALL = 0; MEDIUM = 1; LARGE = 2; } message Coffee { required string name = 1; // espresso required double price = 2; // 340 required Size size = 3; // small / medium / large optional bool isAvailable = 4; // true / false }
data class Coffee( /** * ex) espresso */ @field:WireField(tag =
1, adapter = "com.squareup.wire.ProtoAdapter#STRING") val name: String, /** * ex) 340 */ @field:WireField(tag = 2, adapter = "com.squareup.wire.ProtoAdapter#DOUBLE") val price: Double, /** * ex) small / medium / large */ @field:WireField(tag = 3, adapter = "com.takusemba.proto.Size#ADAPTER") val size: Size, /** * ex) true / false */ @field:WireField(tag = 4, adapter = "com.squareup.wire.ProtoAdapter#BOOL") val isAvailable: Boolean? = null, val unknownFields: ByteString = ByteString.EMPTY ) : Message<Coffee, Coffee.Builder>(ADAPTER, unknownFields) { … }
data class Coffee( /** * ex) espresso */ @field:WireField(tag =
1, adapter = "com.squareup.wire.ProtoAdapter#STRING") val name: String, /** * ex) 340 */ @field:WireField(tag = 2, adapter = "com.squareup.wire.ProtoAdapter#DOUBLE") val price: Double, /** * ex) small / medium / large */ @field:WireField(tag = 3, adapter = "com.takusemba.proto.Size#ADAPTER") val size: Size, /** * ex) true / false */ @field:WireField(tag = 4, adapter = "com.squareup.wire.ProtoAdapter#BOOL") val isAvailable: Boolean? = null, val unknownFields: ByteString = ByteString.EMPTY ) : Message<Coffee, Coffee.Builder>(ADAPTER, unknownFields) { … } val name: String, // required val price: Double, // required val size: Size, // required val isAvailable: Boolean? = null, // optional
https://github.com/takusemba https://twitter.com/takusemba