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
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
LLMと共に進化するプロセスを目指して
ymatsuwitter
12
3.8k
2026TECHFRESH畢業分享會 - 葬送的通靈師:化系統與用戶雜訊成行動訊號
line_developers_tw
PRO
0
580
Bucharest Tech Week 2026 - Reinventing testing practices in the AI era
edeandrea
PRO
1
130
Snowflakeと仲良くなる第一歩
coco_se
4
370
Oracle AI Database@AWS:サービス概要のご紹介
oracle4engineer
PRO
4
2.9k
AmazonRoute 53ではじめてのドメイン取得!HTTPS化までの道のりを整理してみた
usanchuu
3
120
Agentic ERPをどう設計するか ー 受発注エージェントを動かす、現場の知見と設計思想ー
recerqainc
1
2.1k
OCI Oracle AI Database Services新機能アップデート(2026/03-2026/05)
oracle4engineer
PRO
0
330
Amazon Bedrock AgentCore ワークショップ JAWS UG TOHOKU / amazon-bedrock-agentcore-workshop-jawsug-tohoku-2026
gawa
9
570
日本 Fintech 未来予測レポート 2027〜2028年(オリジナル版)
8maki
0
300
失敗を資産に変えるClaude Code
shinyasaita
0
180
2026TECHFRESH畢業分享會 - AI 時代的人生存檔點
line_developers_tw
PRO
0
590
Featured
See All Featured
[SF Ruby Conf 2025] Rails X
palkan
2
1.1k
Test your architecture with Archunit
thirion
1
2.3k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
250
1.3M
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
1
720
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.5k
Building an army of robots
kneath
306
46k
We Have a Design System, Now What?
morganepeng
55
8.2k
Navigating Weather and Climate Data
rabernat
0
220
Context Engineering - Making Every Token Count
addyosmani
9
950
The Pragmatic Product Professional
lauravandoore
37
7.3k
The browser strikes back
jonoalderson
0
1.2k
GraphQLの誤解/rethinking-graphql
sonatard
75
12k
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