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
サイバーエージェントにおけるAI推進戦略と変革への取り組み
shotatsuge
0
680
AIをフル活用してオンコール機能のプロトタイプを2日で作った話 / Building an AI-Powered On-Call Prototype in Just Two Days
nari_ex
0
160
感情と身体を置き去りにしない、エンジニアの生きのこり方 ──いまから、ここから「自分の状態」を扱うという選択
saorimurooka
1
450
AIに「使われる」時代のSaaS戦略 〜既存WebAPIのMCPサーバー化における開発ノウハウ〜
ekispert_api
0
250
製造現場での生成AIの活用、およびエージェントAIの実装のあり方、AVEVAの取り組み
iotcomjpadmin
0
210
フルカイテン株式会社 エンジニア向け採用資料
fullkaiten
0
11k
初めてのDatabricks勉強会
taka_aki
2
220
AI時代における最適なQA組織の作り方
ymty
3
330
技術・能力を向上する原理原則 #きのこセッションa #きのこ2026
bash0c7
0
190
Multi-Agent並列開発を 安全に回すための技術 / Technology for Safely Multi-Agent Parallel Development
tooppoo
0
240
組織における AI-DLC 実践
askul
0
270
スタートアップにおけるアジャイルの実践について #shibuyagile
murabayashi
3
1.9k
Featured
See All Featured
Raft: Consensus for Rubyists
vanstee
141
7.6k
Code Review Best Practice
trishagee
74
20k
Unlocking the hidden potential of vector embeddings in international SEO
frankvandijk
0
860
GraphQLとの向き合い方2022年版
quramy
50
15k
Gemini Prompt Engineering: Practical Techniques for Tangible AI Outcomes
mfonobong
2
450
The browser strikes back
jonoalderson
0
1.3k
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
240
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
2
880
Crafting Experiences
bethany
1
200
Jamie Indigo - Trashchat’s Guide to Black Boxes: Technical SEO Tactics for LLMs
techseoconnect
PRO
0
240
Bootstrapping a Software Product
garrettdimon
PRO
307
120k
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
180
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