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
本当の”仕事”を手放せる未来が見えた
mu7889yoon
0
140
SteampipeとExcel Power QueryでAWS構成定義書の作成を自動化する
jhashimoto
0
180
時期が悪い!それでもRaspberry Piを買って遊んで活用するには / 20260627-osc26do-rpi-jikigawarui
akkiesoft
0
830
AI Agentをシステムに組み込む前にゆるく向き合ってみる
hayama17
0
150
元・セキュリティ学習経験0大学生による業務紹介 / An Introduction to the Job by a Former College Student with Zero Security Training Experience
nttcom
0
200
GitHub Copilot 最新アップデート – 「一歩先」の実践活用術
moulongzhang
5
1.9k
Agile and AI Redmine Japan 2026
hiranabe
4
480
[AWS Summit Japan 2026]迷っているあなたへ_小さな一歩が、やがて自分を助けてくれる
sh_fk2
2
420
【Snowflake Summit 2026 Recap!!】Snowflake Summit Deep Dive: Security & Governance
civitaspo
1
320
週末にループ・エンジニアリングの理解を深めるためのスライド
nagatsu
0
330
AIネイティブな開発のサプライチェーンリスク対策 〜激動の開発現場でリスクに立ち向かう〜【ZennFes】
cscengineer
PRO
2
160
2026-06-24_人とAIの責務分離に基づく開発プロセスの提案.pdf
takahiromatsui
0
180
Featured
See All Featured
Prompt Engineering for Job Search
mfonobong
0
350
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
1
2.7k
Speed Design
sergeychernyshev
33
1.9k
The World Runs on Bad Software
bkeepers
PRO
72
12k
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
0
330
[SF Ruby Conf 2025] Rails X
palkan
2
1.1k
Build your cross-platform service in a week with App Engine
jlugia
234
18k
Kristin Tynski - Automating Marketing Tasks With AI
techseoconnect
PRO
0
280
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
6k
Art, The Web, and Tiny UX
lynnandtonic
304
22k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.5k
Are puppies a ranking factor?
jonoalderson
1
3.6k
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