├── .gitignore ├── .travis.yml ├── LICENSE ├── README.md ├── jmh-run.sh ├── pom.xml ├── scala-serialization-test ├── pom.xml └── src │ └── main │ └── scala │ └── com │ └── komanov │ └── serialization │ └── jmh │ ├── Benchmarks.scala │ └── ProfileMain.scala └── scala-serialization ├── pom.xml └── src ├── main ├── java │ └── com │ │ └── komanov │ │ └── serialization │ │ └── domain │ │ ├── PageComponentType.java │ │ ├── SiteFlag.java │ │ ├── SiteType.java │ │ ├── protos │ │ ├── Events.java │ │ └── Site.java │ │ └── thrift │ │ ├── BlogComponentDataPb.java │ │ ├── BlogComponentDataSetPb.java │ │ ├── ButtonComponentDataPb.java │ │ ├── ButtonComponentDataSetPb.java │ │ ├── DefaultMetaTagAddedPb.java │ │ ├── DefaultMetaTagRemovedPb.java │ │ ├── DomainAddedPb.java │ │ ├── DomainEntryPointAddedPb.java │ │ ├── DomainEntryPointPb.java │ │ ├── DomainPb.java │ │ ├── DomainRemovedPb.java │ │ ├── EntryPointPb.java │ │ ├── EntryPointRemovedPb.java │ │ ├── FreeEntryPointAddedPb.java │ │ ├── FreeEntryPointPb.java │ │ ├── MetaTagPb.java │ │ ├── PageAddedPb.java │ │ ├── PageComponentAddedPb.java │ │ ├── PageComponentDataPb.java │ │ ├── PageComponentPb.java │ │ ├── PageComponentPositionPb.java │ │ ├── PageComponentPositionResetPb.java │ │ ├── PageComponentPositionSetPb.java │ │ ├── PageComponentRemovedPb.java │ │ ├── PageComponentTypePb.java │ │ ├── PageMetaTagAddedPb.java │ │ ├── PageMetaTagRemovedPb.java │ │ ├── PageNameSetPb.java │ │ ├── PagePb.java │ │ ├── PageRemovedPb.java │ │ ├── PrimaryDomainSetPb.java │ │ ├── PrimaryEntryPointSetPb.java │ │ ├── SiteCreatedPb.java │ │ ├── SiteDescriptionSetPb.java │ │ ├── SiteEventDataPb.java │ │ ├── SiteEventPb.java │ │ ├── SiteFlagAddedPb.java │ │ ├── SiteFlagPb.java │ │ ├── SiteFlagRemovedPb.java │ │ ├── SiteNameSetPb.java │ │ ├── SitePb.java │ │ ├── SitePublishedPb.java │ │ ├── SiteRevisionSetPb.java │ │ ├── SiteTypePb.java │ │ ├── SiteUnpublishedPb.java │ │ ├── TextComponentDataPb.java │ │ └── TextComponentDataSetPb.java ├── proto │ ├── events.proto │ ├── events.thrift │ ├── site.proto │ └── site.thrift └── scala │ └── com │ └── komanov │ └── serialization │ ├── converters │ ├── BoopickleConverter.scala │ ├── ChillConverter.scala │ ├── ConversionUtils.scala │ ├── EventConverter.scala │ ├── IoUtils.scala │ ├── JavaPbConverter.scala │ ├── JavaSerializationConverter.scala │ ├── JavaThriftConverter.scala │ ├── JsonConverter.scala │ ├── MyConverter.scala │ ├── PicklingConverter.scala │ ├── ReflectionUtils.scala │ ├── ScalaPbConverter.scala │ ├── ScroogeConverter.scala │ ├── SiteConverter.scala │ ├── TestData.scala │ └── pickling │ │ └── package.scala │ └── domain │ ├── EventProcessor.scala │ ├── Events.scala │ ├── Site.scala │ ├── protos │ ├── events │ │ ├── BlogComponentDataSetPb.scala │ │ ├── ButtonComponentDataSetPb.scala │ │ ├── DefaultMetaTagAddedPb.scala │ │ ├── DefaultMetaTagRemovedPb.scala │ │ ├── DomainAddedPb.scala │ │ ├── DomainEntryPointAddedPb.scala │ │ ├── DomainRemovedPb.scala │ │ ├── EntryPointRemovedPb.scala │ │ ├── EventsProto.scala │ │ ├── FreeEntryPointAddedPb.scala │ │ ├── PageAddedPb.scala │ │ ├── PageComponentAddedPb.scala │ │ ├── PageComponentPositionResetPb.scala │ │ ├── PageComponentPositionSetPb.scala │ │ ├── PageComponentRemovedPb.scala │ │ ├── PageMetaTagAddedPb.scala │ │ ├── PageMetaTagRemovedPb.scala │ │ ├── PageNameSetPb.scala │ │ ├── PageRemovedPb.scala │ │ ├── PrimaryDomainSetPb.scala │ │ ├── PrimaryEntryPointSetPb.scala │ │ ├── SiteCreatedPb.scala │ │ ├── SiteDescriptionSetPb.scala │ │ ├── SiteEventDataPb.scala │ │ ├── SiteEventPb.scala │ │ ├── SiteFlagAddedPb.scala │ │ ├── SiteFlagRemovedPb.scala │ │ ├── SiteNameSetPb.scala │ │ ├── SitePublishedPb.scala │ │ ├── SiteRevisionSetPb.scala │ │ ├── SiteUnpublishedPb.scala │ │ └── TextComponentDataSetPb.scala │ └── site │ │ ├── DomainPb.scala │ │ ├── EntryPointPb.scala │ │ ├── MetaTagPb.scala │ │ ├── PageComponentDataPb.scala │ │ ├── PageComponentPb.scala │ │ ├── PageComponentPositionPb.scala │ │ ├── PageComponentTypePb.scala │ │ ├── PagePb.scala │ │ ├── SiteFlagPb.scala │ │ ├── SitePb.scala │ │ ├── SiteProto.scala │ │ └── SiteTypePb.scala │ └── thriftscala │ ├── BlogComponentDataPb.scala │ ├── BlogComponentDataSetPb.scala │ ├── ButtonComponentDataPb.scala │ ├── ButtonComponentDataSetPb.scala │ ├── DefaultMetaTagAddedPb.scala │ ├── DefaultMetaTagRemovedPb.scala │ ├── DomainAddedPb.scala │ ├── DomainEntryPointAddedPb.scala │ ├── DomainEntryPointPb.scala │ ├── DomainPb.scala │ ├── DomainRemovedPb.scala │ ├── EntryPointPb.scala │ ├── EntryPointRemovedPb.scala │ ├── FreeEntryPointAddedPb.scala │ ├── FreeEntryPointPb.scala │ ├── MetaTagPb.scala │ ├── PageAddedPb.scala │ ├── PageComponentAddedPb.scala │ ├── PageComponentDataPb.scala │ ├── PageComponentPb.scala │ ├── PageComponentPositionPb.scala │ ├── PageComponentPositionResetPb.scala │ ├── PageComponentPositionSetPb.scala │ ├── PageComponentRemovedPb.scala │ ├── PageComponentTypePb.scala │ ├── PageMetaTagAddedPb.scala │ ├── PageMetaTagRemovedPb.scala │ ├── PageNameSetPb.scala │ ├── PagePb.scala │ ├── PageRemovedPb.scala │ ├── PrimaryDomainSetPb.scala │ ├── PrimaryEntryPointSetPb.scala │ ├── SiteCreatedPb.scala │ ├── SiteDescriptionSetPb.scala │ ├── SiteEventDataPb.scala │ ├── SiteEventPb.scala │ ├── SiteFlagAddedPb.scala │ ├── SiteFlagPb.scala │ ├── SiteFlagRemovedPb.scala │ ├── SiteNameSetPb.scala │ ├── SitePb.scala │ ├── SitePublishedPb.scala │ ├── SiteRevisionSetPb.scala │ ├── SiteTypePb.scala │ ├── SiteUnpublishedPb.scala │ ├── TextComponentDataPb.scala │ └── TextComponentDataSetPb.scala └── test └── scala └── com └── komanov └── serialization ├── converters ├── BasePerfTest.scala ├── ConversionsUtilsTest.scala ├── Converters.scala ├── EventsReportGenerator.scala ├── ReportGenerator.scala └── SerializationTest.scala └── domain └── EventProcessorTest.scala /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | target 3 | *.iml 4 | jmh.log 5 | jmh-result.json 6 | gh-pages 7 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: java 2 | jdk: 3 | - oraclejdk8 4 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Dmitry Komanov 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | A source code for the article "Scala Serialization" at [medium](https://medium.com/@dkomanov/scala-serialization-419d175c888a) is moved to [another repository](https://github.com/dkomanov/stuff/tree/master/src/com/komanov/serialization). Old [charts](https://komanov.com/charts/scala-serialization/), [new charts](https://komanov.com/charts/scala-serialization-2022/). 2 | -------------------------------------------------------------------------------- /jmh-run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | 3 | ec() { 4 | echo $* 1>&2 5 | $* 6 | } 7 | 8 | # expecting a gh-pages symlink in a root directory 9 | GH_PAGES_PATH=`readlink gh-pages` 10 | # ensure that git repository exists there 11 | ec git -C $GH_PAGES_PATH status > /dev/null 12 | 13 | ec mvn clean install 14 | 15 | ec java -jar scala-serialization-test/target/benchmarks.jar -rf json -rff jmh-result.json > jmh.log 16 | 17 | ec mv jmh-result.json $GH_PAGES_PATH 18 | 19 | echo "Don't forget to push gh-pages!" 20 | -------------------------------------------------------------------------------- /scala-serialization-test/src/main/scala/com/komanov/serialization/jmh/ProfileMain.scala: -------------------------------------------------------------------------------- 1 | package com.komanov.serialization.jmh 2 | 3 | import org.openjdk.jmh.profile.StackProfiler 4 | import org.openjdk.jmh.runner.Runner 5 | import org.openjdk.jmh.runner.options.OptionsBuilder 6 | 7 | object ProfileMain { 8 | 9 | def main(args: Array[String]): Unit = { 10 | // same as: -prof stack -jvmArgsAppend '-Djmh.stack.lines=10' 11 | val opt = new OptionsBuilder() 12 | .addProfiler(classOf[StackProfiler]) 13 | .jvmArgsAppend("-Djmh.stack.lines=10") 14 | //.include("ChillBenchmark.serialization_events_1k") 15 | .build() 16 | 17 | new Runner(opt).run() 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /scala-serialization/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | com.komanov 8 | scala-serialization 9 | 1.0-SNAPSHOT 10 | 11 | 12 | scala-serialization-all 13 | com.komanov 14 | 1.0-SNAPSHOT 15 | 16 | 17 | 18 | 19 | org.scala-lang 20 | scala-library 21 | 2.11.7 22 | 23 | 24 | com.twitter 25 | util-core_2.11 26 | 6.34.0 27 | 28 | 29 | commons-io 30 | commons-io 31 | 2.4 32 | 33 | 34 | 35 | com.fasterxml.jackson.core 36 | jackson-databind 37 | 2.9.10.4 38 | 39 | 40 | com.fasterxml.jackson.core 41 | jackson-core 42 | 2.7.3 43 | 44 | 45 | com.fasterxml.jackson.module 46 | jackson-module-scala_2.11 47 | 2.7.3 48 | 49 | 50 | com.google.protobuf 51 | protobuf-java 52 | 3.0.0-beta-2 53 | 54 | 55 | com.trueaccord.scalapb 56 | scalapb-runtime_2.11 57 | 0.5.31 58 | 59 | 60 | org.scala-lang.modules 61 | scala-pickling_2.11 62 | 0.11.0-M2 63 | 64 | 65 | me.chrons 66 | boopickle_2.11 67 | 1.2.4 68 | 69 | 70 | com.twitter 71 | chill_2.11 72 | 0.8.0 73 | 74 | 75 | org.apache.thrift 76 | libthrift 77 | 0.9.1 78 | 79 | 80 | 81 | org.slf4j 82 | slf4j-simple 83 | 1.7.21 84 | 85 | 86 | com.twitter 87 | scrooge-core_2.11 88 | 4.7.0 89 | 90 | 91 | 92 | 93 | 94 | org.specs2 95 | specs2-core_2.11 96 | 3.8.3 97 | test 98 | 99 | 100 | org.specs2 101 | specs2-matcher-extra_2.11 102 | 3.8.3 103 | test 104 | 105 | 106 | org.specs2 107 | specs2-mock_2.11 108 | 3.8.3 109 | test 110 | 111 | 112 | org.specs2 113 | specs2-junit_2.11 114 | 3.8.3 115 | test 116 | 117 | 118 | 119 | 120 | -------------------------------------------------------------------------------- /scala-serialization/src/main/java/com/komanov/serialization/domain/PageComponentType.java: -------------------------------------------------------------------------------- 1 | package com.komanov.serialization.domain; 2 | 3 | public enum PageComponentType { 4 | Unknown, 5 | Text, 6 | Button, 7 | Blog, 8 | } 9 | -------------------------------------------------------------------------------- /scala-serialization/src/main/java/com/komanov/serialization/domain/SiteFlag.java: -------------------------------------------------------------------------------- 1 | package com.komanov.serialization.domain; 2 | 3 | public enum SiteFlag { 4 | Unknown, 5 | Free, 6 | Premium, 7 | } 8 | -------------------------------------------------------------------------------- /scala-serialization/src/main/java/com/komanov/serialization/domain/SiteType.java: -------------------------------------------------------------------------------- 1 | package com.komanov.serialization.domain; 2 | 3 | public enum SiteType { 4 | Unknown, 5 | Flash, 6 | Silverlight, 7 | Html5, 8 | } 9 | -------------------------------------------------------------------------------- /scala-serialization/src/main/java/com/komanov/serialization/domain/thrift/PageComponentTypePb.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Thrift Compiler (0.9.3) 3 | * 4 | * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | * @generated 6 | */ 7 | package com.komanov.serialization.domain.thrift; 8 | 9 | 10 | import java.util.Map; 11 | import java.util.HashMap; 12 | import org.apache.thrift.TEnum; 13 | 14 | public enum PageComponentTypePb implements org.apache.thrift.TEnum { 15 | UnknownPageComponentType(0), 16 | Text(1), 17 | Button(2), 18 | Blog(3); 19 | 20 | private final int value; 21 | 22 | private PageComponentTypePb(int value) { 23 | this.value = value; 24 | } 25 | 26 | /** 27 | * Get the integer value of this enum value, as defined in the Thrift IDL. 28 | */ 29 | public int getValue() { 30 | return value; 31 | } 32 | 33 | /** 34 | * Find a the enum type by its integer value, as defined in the Thrift IDL. 35 | * @return null if the value is not found. 36 | */ 37 | public static PageComponentTypePb findByValue(int value) { 38 | switch (value) { 39 | case 0: 40 | return UnknownPageComponentType; 41 | case 1: 42 | return Text; 43 | case 2: 44 | return Button; 45 | case 3: 46 | return Blog; 47 | default: 48 | return null; 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /scala-serialization/src/main/java/com/komanov/serialization/domain/thrift/SiteFlagPb.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Thrift Compiler (0.9.3) 3 | * 4 | * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | * @generated 6 | */ 7 | package com.komanov.serialization.domain.thrift; 8 | 9 | 10 | import java.util.Map; 11 | import java.util.HashMap; 12 | import org.apache.thrift.TEnum; 13 | 14 | public enum SiteFlagPb implements org.apache.thrift.TEnum { 15 | UnknownSiteFlag(0), 16 | Free(1), 17 | Premium(2); 18 | 19 | private final int value; 20 | 21 | private SiteFlagPb(int value) { 22 | this.value = value; 23 | } 24 | 25 | /** 26 | * Get the integer value of this enum value, as defined in the Thrift IDL. 27 | */ 28 | public int getValue() { 29 | return value; 30 | } 31 | 32 | /** 33 | * Find a the enum type by its integer value, as defined in the Thrift IDL. 34 | * @return null if the value is not found. 35 | */ 36 | public static SiteFlagPb findByValue(int value) { 37 | switch (value) { 38 | case 0: 39 | return UnknownSiteFlag; 40 | case 1: 41 | return Free; 42 | case 2: 43 | return Premium; 44 | default: 45 | return null; 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /scala-serialization/src/main/java/com/komanov/serialization/domain/thrift/SiteTypePb.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Thrift Compiler (0.9.3) 3 | * 4 | * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | * @generated 6 | */ 7 | package com.komanov.serialization.domain.thrift; 8 | 9 | 10 | import java.util.Map; 11 | import java.util.HashMap; 12 | import org.apache.thrift.TEnum; 13 | 14 | public enum SiteTypePb implements org.apache.thrift.TEnum { 15 | UnknownSiteType(0), 16 | Flash(1), 17 | Silverlight(2), 18 | Html5(3); 19 | 20 | private final int value; 21 | 22 | private SiteTypePb(int value) { 23 | this.value = value; 24 | } 25 | 26 | /** 27 | * Get the integer value of this enum value, as defined in the Thrift IDL. 28 | */ 29 | public int getValue() { 30 | return value; 31 | } 32 | 33 | /** 34 | * Find a the enum type by its integer value, as defined in the Thrift IDL. 35 | * @return null if the value is not found. 36 | */ 37 | public static SiteTypePb findByValue(int value) { 38 | switch (value) { 39 | case 0: 40 | return UnknownSiteType; 41 | case 1: 42 | return Flash; 43 | case 2: 44 | return Silverlight; 45 | case 3: 46 | return Html5; 47 | default: 48 | return null; 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /scala-serialization/src/main/proto/events.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package com.komanov.serialization.domain.protos; 4 | 5 | import "src/main/proto/site.proto"; 6 | 7 | message SiteCreatedPb { 8 | bytes id = 1; 9 | bytes ownerId = 2; 10 | SiteTypePb siteType = 3; 11 | } 12 | 13 | message SiteNameSetPb { 14 | string name = 1; 15 | } 16 | 17 | message SiteDescriptionSetPb { 18 | string description = 1; 19 | } 20 | 21 | message SiteRevisionSetPb { 22 | uint64 revision = 1; 23 | } 24 | 25 | message SitePublishedPb { 26 | } 27 | 28 | message SiteUnpublishedPb { 29 | } 30 | 31 | // SiteFlag 32 | 33 | message SiteFlagAddedPb { 34 | SiteFlagPb siteFlag = 1; 35 | } 36 | 37 | message SiteFlagRemovedPb { 38 | SiteFlagPb siteFlag = 1; 39 | } 40 | 41 | // Domain 42 | 43 | message DomainAddedPb { 44 | string name = 1; 45 | } 46 | 47 | message DomainRemovedPb { 48 | string name = 1; 49 | } 50 | 51 | message PrimaryDomainSetPb { 52 | string name = 1; 53 | } 54 | 55 | // DefaultMetaTag 56 | 57 | message DefaultMetaTagAddedPb { 58 | string name = 1; 59 | string value = 2; 60 | } 61 | 62 | message DefaultMetaTagRemovedPb { 63 | string name = 1; 64 | } 65 | 66 | // Page 67 | 68 | message PageAddedPb { 69 | string path = 1; 70 | } 71 | 72 | message PageRemovedPb { 73 | string path = 1; 74 | } 75 | 76 | message PageNameSetPb { 77 | string path = 1; 78 | string name = 2; 79 | } 80 | 81 | message PageMetaTagAddedPb { 82 | string path = 1; 83 | string name = 2; 84 | string value = 3; 85 | } 86 | 87 | message PageMetaTagRemovedPb { 88 | string path = 1; 89 | string name = 2; 90 | } 91 | 92 | // Page::PageComponent 93 | 94 | message PageComponentAddedPb { 95 | string pagePath = 1; 96 | bytes id = 2; 97 | PageComponentTypePb componentType = 3; 98 | } 99 | 100 | message PageComponentRemovedPb { 101 | string pagePath = 1; 102 | bytes id = 2; 103 | } 104 | 105 | message PageComponentPositionSetPb { 106 | bytes id = 1; 107 | uint32 x = 2; 108 | uint32 y = 3; 109 | } 110 | 111 | message PageComponentPositionResetPb { 112 | bytes id = 1; 113 | } 114 | 115 | message TextComponentDataSetPb { 116 | bytes id = 1; 117 | string text = 2; 118 | } 119 | 120 | message ButtonComponentDataSetPb { 121 | bytes id = 1; 122 | string name = 2; 123 | string text = 3; 124 | bytes action = 4; 125 | } 126 | 127 | message BlogComponentDataSetPb { 128 | bytes id = 1; 129 | string name = 2; 130 | bool rss = 3; 131 | bool tags = 4; 132 | } 133 | 134 | // EntryPoint 135 | 136 | message DomainEntryPointAddedPb { 137 | string domain = 1; 138 | } 139 | 140 | message FreeEntryPointAddedPb { 141 | string userName = 1; 142 | string siteName = 2; 143 | } 144 | 145 | message EntryPointRemovedPb { 146 | string lookupKey = 1; 147 | } 148 | 149 | message PrimaryEntryPointSetPb { 150 | string lookupKey = 1; 151 | } 152 | 153 | message SiteEventPb { 154 | oneof ev { 155 | SiteCreatedPb SiteCreatedPb = 1; 156 | SiteNameSetPb SiteNameSetPb = 2; 157 | SiteDescriptionSetPb SiteDescriptionSetPb = 3; 158 | SiteRevisionSetPb SiteRevisionSetPb = 4; 159 | SitePublishedPb SitePublishedPb = 5; 160 | SiteUnpublishedPb SiteUnpublishedPb = 6; 161 | SiteFlagAddedPb SiteFlagAddedPb = 7; 162 | SiteFlagRemovedPb SiteFlagRemovedPb = 8; 163 | DomainAddedPb DomainAddedPb = 9; 164 | DomainRemovedPb DomainRemovedPb = 10; 165 | PrimaryDomainSetPb PrimaryDomainSetPb = 11; 166 | DefaultMetaTagAddedPb DefaultMetaTagAddedPb = 12; 167 | DefaultMetaTagRemovedPb DefaultMetaTagRemovedPb = 13; 168 | PageAddedPb PageAddedPb = 14; 169 | PageRemovedPb PageRemovedPb = 15; 170 | PageNameSetPb PageNameSetPb = 16; 171 | PageMetaTagAddedPb PageMetaTagAddedPb = 17; 172 | PageMetaTagRemovedPb PageMetaTagRemovedPb = 18; 173 | PageComponentAddedPb PageComponentAddedPb = 19; 174 | PageComponentRemovedPb PageComponentRemovedPb = 20; 175 | PageComponentPositionSetPb PageComponentPositionSetPb = 21; 176 | PageComponentPositionResetPb PageComponentPositionResetPb = 22; 177 | TextComponentDataSetPb TextComponentDataSetPb = 23; 178 | ButtonComponentDataSetPb ButtonComponentDataSetPb = 24; 179 | BlogComponentDataSetPb BlogComponentDataSetPb = 25; 180 | DomainEntryPointAddedPb DomainEntryPointAddedPb = 26; 181 | FreeEntryPointAddedPb FreeEntryPointAddedPb = 27; 182 | EntryPointRemovedPb EntryPointRemovedPb = 28; 183 | PrimaryEntryPointSetPb PrimaryEntryPointSetPb = 29; 184 | } 185 | } 186 | 187 | message SiteEventDataPb { 188 | bytes id = 1; 189 | SiteEventPb ev = 2; 190 | uint64 timestamp = 3; 191 | } 192 | -------------------------------------------------------------------------------- /scala-serialization/src/main/proto/events.thrift: -------------------------------------------------------------------------------- 1 | namespace java com.komanov.serialization.domain.thrift 2 | namespace scala com.komanov.serialization.domain.thriftscala 3 | 4 | enum SiteTypePb { 5 | UnknownSiteType = 0, 6 | Flash = 1, 7 | Silverlight = 2, 8 | Html5 = 3 9 | } 10 | 11 | enum SiteFlagPb { 12 | UnknownSiteFlag = 0, 13 | Free = 1, 14 | Premium = 2 15 | } 16 | 17 | enum PageComponentTypePb { 18 | UnknownPageComponentType = 0, 19 | Text = 1, 20 | Button = 2, 21 | Blog = 3 22 | } 23 | 24 | struct SiteCreatedPb { 25 | 1: optional binary id, 26 | 2: optional binary ownerId, 27 | 3: optional SiteTypePb siteType, 28 | } 29 | 30 | struct SiteNameSetPb { 31 | 1: optional string name, 32 | } 33 | 34 | struct SiteDescriptionSetPb { 35 | 1: optional string description, 36 | } 37 | 38 | struct SiteRevisionSetPb { 39 | 1: optional i64 revision, 40 | } 41 | 42 | struct SitePublishedPb { 43 | } 44 | 45 | struct SiteUnpublishedPb { 46 | } 47 | 48 | // SiteFlag 49 | 50 | struct SiteFlagAddedPb { 51 | 1: optional SiteFlagPb siteFlag, 52 | } 53 | 54 | struct SiteFlagRemovedPb { 55 | 1: optional SiteFlagPb siteFlag, 56 | } 57 | 58 | // Domain 59 | 60 | struct DomainAddedPb { 61 | 1: optional string name, 62 | } 63 | 64 | struct DomainRemovedPb { 65 | 1: optional string name, 66 | } 67 | 68 | struct PrimaryDomainSetPb { 69 | 1: optional string name, 70 | } 71 | 72 | // DefaultMetaTag 73 | 74 | struct DefaultMetaTagAddedPb { 75 | 1: optional string name, 76 | 2: optional string value, 77 | } 78 | 79 | struct DefaultMetaTagRemovedPb { 80 | 1: optional string name, 81 | } 82 | 83 | // Page 84 | 85 | struct PageAddedPb { 86 | 1: optional string path, 87 | } 88 | 89 | struct PageRemovedPb { 90 | 1: optional string path, 91 | } 92 | 93 | struct PageNameSetPb { 94 | 1: optional string path, 95 | 2: optional string name, 96 | } 97 | 98 | struct PageMetaTagAddedPb { 99 | 1: optional string path, 100 | 2: optional string name, 101 | 3: optional string value, 102 | } 103 | 104 | struct PageMetaTagRemovedPb { 105 | 1: optional string path, 106 | 2: optional string name, 107 | } 108 | 109 | // Page::PageComponent 110 | 111 | struct PageComponentAddedPb { 112 | 1: optional string pagePath, 113 | 2: optional binary id, 114 | 3: optional PageComponentTypePb componentType, 115 | } 116 | 117 | struct PageComponentRemovedPb { 118 | 1: optional string pagePath, 119 | 2: optional binary id, 120 | } 121 | 122 | struct PageComponentPositionSetPb { 123 | 1: optional binary id, 124 | 2: optional i32 x, 125 | 3: optional i32 y, 126 | } 127 | 128 | struct PageComponentPositionResetPb { 129 | 1: optional binary id, 130 | } 131 | 132 | struct TextComponentDataSetPb { 133 | 1: optional binary id, 134 | 2: optional string text, 135 | } 136 | 137 | struct ButtonComponentDataSetPb { 138 | 1: optional binary id, 139 | 2: optional string name, 140 | 3: optional string text, 141 | 4: optional binary action, 142 | } 143 | 144 | struct BlogComponentDataSetPb { 145 | 1: optional binary id, 146 | 2: optional string name, 147 | 3: optional bool rss, 148 | 4: optional bool tags, 149 | } 150 | 151 | // EntryPoint 152 | 153 | struct DomainEntryPointAddedPb { 154 | 1: optional string domain, 155 | } 156 | 157 | struct FreeEntryPointAddedPb { 158 | 1: optional string userName, 159 | 2: optional string siteName, 160 | } 161 | 162 | struct EntryPointRemovedPb { 163 | 1: optional string lookupKey, 164 | } 165 | 166 | struct PrimaryEntryPointSetPb { 167 | 1: optional string lookupKey, 168 | } 169 | 170 | struct SiteEventPb { 171 | 1: optional SiteCreatedPb SiteCreatedPb, 172 | 2: optional SiteNameSetPb SiteNameSetPb, 173 | 3: optional SiteDescriptionSetPb SiteDescriptionSetPb, 174 | 4: optional SiteRevisionSetPb SiteRevisionSetPb, 175 | 5: optional SitePublishedPb SitePublishedPb, 176 | 6: optional SiteUnpublishedPb SiteUnpublishedPb, 177 | 7: optional SiteFlagAddedPb SiteFlagAddedPb, 178 | 8: optional SiteFlagRemovedPb SiteFlagRemovedPb, 179 | 9: optional DomainAddedPb DomainAddedPb, 180 | 10: optional DomainRemovedPb DomainRemovedPb, 181 | 11: optional PrimaryDomainSetPb PrimaryDomainSetPb, 182 | 12: optional DefaultMetaTagAddedPb DefaultMetaTagAddedPb, 183 | 13: optional DefaultMetaTagRemovedPb DefaultMetaTagRemovedPb, 184 | 14: optional PageAddedPb PageAddedPb, 185 | 15: optional PageRemovedPb PageRemovedPb, 186 | 16: optional PageNameSetPb PageNameSetPb, 187 | 17: optional PageMetaTagAddedPb PageMetaTagAddedPb, 188 | 18: optional PageMetaTagRemovedPb PageMetaTagRemovedPb, 189 | 19: optional PageComponentAddedPb PageComponentAddedPb, 190 | 20: optional PageComponentRemovedPb PageComponentRemovedPb, 191 | 21: optional PageComponentPositionSetPb PageComponentPositionSetPb, 192 | 22: optional PageComponentPositionResetPb PageComponentPositionResetPb, 193 | 23: optional TextComponentDataSetPb TextComponentDataSetPb, 194 | 24: optional ButtonComponentDataSetPb ButtonComponentDataSetPb, 195 | 25: optional BlogComponentDataSetPb BlogComponentDataSetPb, 196 | 26: optional DomainEntryPointAddedPb DomainEntryPointAddedPb, 197 | 27: optional FreeEntryPointAddedPb FreeEntryPointAddedPb, 198 | 28: optional EntryPointRemovedPb EntryPointRemovedPb, 199 | 29: optional PrimaryEntryPointSetPb PrimaryEntryPointSetPb, 200 | } 201 | 202 | struct SiteEventDataPb { 203 | 1: optional binary id, 204 | 2: optional SiteEventPb ev, 205 | 3: optional i64 timestamp, 206 | } 207 | -------------------------------------------------------------------------------- /scala-serialization/src/main/proto/site.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package com.komanov.serialization.domain.protos; 4 | 5 | enum SiteTypePb { 6 | UnknownSiteType = 0; 7 | Flash = 1; 8 | Silverlight = 2; 9 | Html5 = 3; 10 | } 11 | 12 | enum SiteFlagPb { 13 | UnknownSiteFlag = 0; 14 | Free = 1; 15 | Premium = 2; 16 | } 17 | 18 | enum PageComponentTypePb { 19 | UnknownPageComponentType = 0; 20 | Text = 1; 21 | Button = 2; 22 | Blog = 3; 23 | } 24 | 25 | message DomainPb { 26 | string name = 1; 27 | bool primary = 2; 28 | } 29 | 30 | message EntryPointPb { 31 | oneof ep { 32 | DomainEntryPointPb domain = 1; 33 | FreeEntryPointPb free = 2; 34 | } 35 | 36 | message DomainEntryPointPb { 37 | string domain = 1; 38 | bool primary = 2; 39 | } 40 | 41 | message FreeEntryPointPb { 42 | string userName = 1; 43 | string siteName = 2; 44 | bool primary = 3; 45 | } 46 | } 47 | 48 | message MetaTagPb { 49 | string name = 1; 50 | string value = 2; 51 | } 52 | 53 | message PageComponentDataPb { 54 | oneof data { 55 | TextComponentDataPb text = 1; 56 | ButtonComponentDataPb button = 2; 57 | BlogComponentDataPb blog = 3; 58 | } 59 | 60 | message TextComponentDataPb { 61 | string text = 1; 62 | } 63 | 64 | message ButtonComponentDataPb { 65 | string name = 1; 66 | string text = 2; 67 | bytes action = 3; 68 | } 69 | 70 | message BlogComponentDataPb { 71 | string name = 1; 72 | bool rss = 2; 73 | bool tags = 3; 74 | } 75 | } 76 | 77 | message PageComponentPositionPb { 78 | uint32 x = 1; 79 | uint32 y = 2; 80 | } 81 | 82 | message PageComponentPb { 83 | bytes id = 1; 84 | PageComponentTypePb componentType = 2; 85 | PageComponentDataPb data = 3; 86 | PageComponentPositionPb position = 4; 87 | uint64 dateCreated = 5; 88 | uint64 dateUpdated = 6; 89 | } 90 | 91 | message PagePb { 92 | string name = 1; 93 | string path = 2; 94 | repeated MetaTagPb metaTags = 3; 95 | repeated PageComponentPb components = 4; 96 | } 97 | 98 | message SitePb { 99 | bytes id = 1; 100 | bytes ownerId = 2; 101 | uint64 revision = 3; 102 | SiteTypePb siteType = 4; 103 | repeated SiteFlagPb flags = 5; 104 | string name = 6; 105 | string description = 7; 106 | repeated DomainPb domains = 8; 107 | repeated MetaTagPb defaultMetaTags = 9; 108 | repeated PagePb pages = 10; 109 | repeated EntryPointPb entryPoints = 11; 110 | bool published = 12; 111 | uint64 dateCreated = 13; 112 | uint64 dateUpdated = 14; 113 | } 114 | -------------------------------------------------------------------------------- /scala-serialization/src/main/proto/site.thrift: -------------------------------------------------------------------------------- 1 | namespace java com.komanov.serialization.domain.thrift 2 | namespace scala com.komanov.serialization.domain.thriftscala 3 | 4 | enum SiteTypePb { 5 | UnknownSiteType = 0, 6 | Flash = 1, 7 | Silverlight = 2, 8 | Html5 = 3 9 | } 10 | 11 | enum SiteFlagPb { 12 | UnknownSiteFlag = 0, 13 | Free = 1, 14 | Premium = 2 15 | } 16 | 17 | enum PageComponentTypePb { 18 | UnknownPageComponentType = 0, 19 | Text = 1, 20 | Button = 2, 21 | Blog = 3 22 | } 23 | 24 | struct DomainPb { 25 | 1: optional string name, 26 | 2: optional bool primary 27 | } 28 | 29 | struct DomainEntryPointPb { 30 | 1: optional string domain, 31 | 2: optional bool primary 32 | } 33 | 34 | struct FreeEntryPointPb { 35 | 1: optional string userName, 36 | 2: optional string siteName, 37 | 3: optional bool primary 38 | } 39 | 40 | struct EntryPointPb { 41 | 1: optional DomainEntryPointPb domain, 42 | 2: optional FreeEntryPointPb free 43 | } 44 | 45 | struct MetaTagPb { 46 | 1: optional string name, 47 | 2: optional string value 48 | } 49 | 50 | struct TextComponentDataPb { 51 | 1: optional string text 52 | } 53 | 54 | struct ButtonComponentDataPb { 55 | 1: optional string name, 56 | 2: optional string text, 57 | 3: optional binary action 58 | } 59 | 60 | struct BlogComponentDataPb { 61 | 1: optional string name, 62 | 2: optional bool rss, 63 | 3: optional bool tags 64 | } 65 | 66 | struct PageComponentDataPb { 67 | 1: optional TextComponentDataPb text, 68 | 2: optional ButtonComponentDataPb button, 69 | 3: optional BlogComponentDataPb blog 70 | } 71 | 72 | struct PageComponentPositionPb { 73 | 1: optional i32 x, 74 | 2: optional i32 y 75 | } 76 | 77 | struct PageComponentPb { 78 | 1: optional binary id, 79 | 2: optional PageComponentTypePb componentType, 80 | 3: optional PageComponentDataPb data, 81 | 4: optional PageComponentPositionPb position, 82 | 5: optional i64 dateCreated, 83 | 6: optional i64 dateUpdated 84 | } 85 | 86 | struct PagePb { 87 | 1: optional string name, 88 | 2: optional string path, 89 | 3: optional list metaTags, 90 | 4: optional list components 91 | } 92 | 93 | struct SitePb { 94 | 1: optional binary id, 95 | 2: optional binary ownerId, 96 | 3: optional i64 revision, 97 | 4: optional SiteTypePb siteType, 98 | 5: optional list flags, 99 | 6: optional string name, 100 | 7: optional string description, 101 | 8: optional list domains, 102 | 9: optional list defaultMetaTags, 103 | 10: optional list pages, 104 | 11: optional list entryPoints, 105 | 12: optional bool published, 106 | 13: optional i64 dateCreated, 107 | 14: optional i64 dateUpdated 108 | } 109 | -------------------------------------------------------------------------------- /scala-serialization/src/main/scala/com/komanov/serialization/converters/BoopickleConverter.scala: -------------------------------------------------------------------------------- 1 | package com.komanov.serialization.converters 2 | 3 | import java.nio.ByteBuffer 4 | import java.time.Instant 5 | import java.util 6 | 7 | import boopickle.Default._ 8 | import boopickle.{BufferPool, DecoderSize, EncoderSize} 9 | import com.komanov.serialization.domain._ 10 | 11 | /** https://github.com/ochrons/boopickle */ 12 | object BoopickleConverter extends MyConverter { 13 | 14 | implicit def pickleState = new PickleState(new EncoderSize, false, false) 15 | implicit val unpickleState = (bb: ByteBuffer) => new UnpickleState(new DecoderSize(bb), false, false) 16 | 17 | BufferPool.disable() 18 | 19 | override def toByteArray(site: Site): Array[Byte] = { 20 | val bb = Pickle.intoBytes(site) 21 | val a = bbToArray(bb) 22 | BufferPool.release(bb) 23 | a 24 | } 25 | 26 | override def fromByteArray(bytes: Array[Byte]): Site = { 27 | Unpickle[Site].fromBytes(ByteBuffer.wrap(bytes)) 28 | } 29 | 30 | override def toByteArray(event: SiteEvent): Array[Byte] = { 31 | val bb = Pickle.intoBytes(event) 32 | val a = bbToArray(bb) 33 | BufferPool.release(bb) 34 | a 35 | } 36 | 37 | override def siteEventFromByteArray(clazz: Class[_], bytes: Array[Byte]): SiteEvent = { 38 | Unpickle[SiteEvent].fromBytes(ByteBuffer.wrap(bytes)) 39 | } 40 | 41 | private def bbToArray(bb: ByteBuffer) = { 42 | util.Arrays.copyOfRange(bb.array(), 0, bb.limit()) 43 | } 44 | 45 | implicit val instantPickler = transformPickler[Instant, Long](t => Instant.ofEpochMilli(t))(_.toEpochMilli) 46 | 47 | implicit val pageComponentTypePickler = transformPickler(PageComponentType.valueOf)(_.name()) 48 | implicit val siteFlagPickler = transformPickler(SiteFlag.valueOf)(_.name()) 49 | implicit val siteTypePickler = transformPickler(SiteType.valueOf)(_.name()) 50 | 51 | implicit val entryPointPickler = compositePickler[EntryPoint] 52 | .addConcreteType[DomainEntryPoint] 53 | .addConcreteType[FreeEntryPoint] 54 | 55 | implicit val pageComponentDataPickler = compositePickler[PageComponentData] 56 | .addConcreteType[TextComponentData] 57 | .addConcreteType[ButtonComponentData] 58 | .addConcreteType[BlogComponentData] 59 | 60 | implicit val siteEventPickler = compositePickler[SiteEvent] 61 | .addConcreteType[SiteCreated] 62 | .addConcreteType[SiteNameSet] 63 | .addConcreteType[SiteDescriptionSet] 64 | .addConcreteType[SiteRevisionSet] 65 | .addConcreteType[SitePublished] 66 | .addConcreteType[SiteUnpublished] 67 | .addConcreteType[SiteFlagAdded] 68 | .addConcreteType[SiteFlagRemoved] 69 | .addConcreteType[DomainAdded] 70 | .addConcreteType[DomainRemoved] 71 | .addConcreteType[PrimaryDomainSet] 72 | .addConcreteType[DefaultMetaTagAdded] 73 | .addConcreteType[DefaultMetaTagRemoved] 74 | .addConcreteType[PageAdded] 75 | .addConcreteType[PageRemoved] 76 | .addConcreteType[PageNameSet] 77 | .addConcreteType[PageMetaTagAdded] 78 | .addConcreteType[PageMetaTagRemoved] 79 | .addConcreteType[PageComponentAdded] 80 | .addConcreteType[PageComponentRemoved] 81 | .addConcreteType[PageComponentPositionSet] 82 | .addConcreteType[PageComponentPositionReset] 83 | .addConcreteType[TextComponentDataSet] 84 | .addConcreteType[ButtonComponentDataSet] 85 | .addConcreteType[BlogComponentDataSet] 86 | .addConcreteType[DomainEntryPointAdded] 87 | .addConcreteType[FreeEntryPointAdded] 88 | .addConcreteType[EntryPointRemoved] 89 | .addConcreteType[PrimaryEntryPointSet] 90 | } 91 | -------------------------------------------------------------------------------- /scala-serialization/src/main/scala/com/komanov/serialization/converters/ChillConverter.scala: -------------------------------------------------------------------------------- 1 | package com.komanov.serialization.converters 2 | 3 | import com.komanov.serialization.domain.{Site, SiteEvent, SiteEventData} 4 | import com.twitter.chill.ScalaKryoInstantiator 5 | 6 | /** https://github.com/twitter/chill */ 7 | object ChillConverter extends MyConverter { 8 | 9 | private val pool = ScalaKryoInstantiator.defaultPool 10 | 11 | override def toByteArray(site: Site): Array[Byte] = { 12 | pool.toBytesWithoutClass(site) 13 | } 14 | 15 | override def fromByteArray(bytes: Array[Byte]): Site = { 16 | pool.fromBytes(bytes, classOf[Site]) 17 | } 18 | 19 | override def toByteArray(event: SiteEvent): Array[Byte] = { 20 | pool.toBytesWithoutClass(event) 21 | } 22 | 23 | override def siteEventFromByteArray(clazz: Class[_], bytes: Array[Byte]): SiteEvent = { 24 | pool.fromBytes(bytes, clazz).asInstanceOf[SiteEvent] 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /scala-serialization/src/main/scala/com/komanov/serialization/converters/ConversionUtils.scala: -------------------------------------------------------------------------------- 1 | package com.komanov.serialization.converters 2 | 3 | import java.nio.ByteBuffer 4 | import java.time.Instant 5 | import java.util.UUID 6 | 7 | import com.google.protobuf.ByteString 8 | 9 | object ConversionUtils { 10 | 11 | def uuidToBytes(uuid: UUID): ByteString = { 12 | val bb = uuidToByteBuffer(uuid) 13 | if (bb == null) ByteString.EMPTY else ByteString.copyFrom(bb) 14 | } 15 | 16 | def uuidToByteBuffer(uuid: UUID): ByteBuffer = { 17 | if (uuid == null) { 18 | return null 19 | } 20 | 21 | val buffer = ByteBuffer.allocate(16) 22 | buffer.putLong(uuid.getMostSignificantBits) 23 | buffer.putLong(uuid.getLeastSignificantBits) 24 | buffer.rewind() 25 | buffer 26 | } 27 | 28 | def bytesToUuid(bb: ByteBuffer): UUID = { 29 | if (bb == null) { 30 | return null 31 | } 32 | 33 | val length = bb.limit() - bb.position() 34 | if (length == 0) { 35 | return null 36 | } 37 | 38 | require(length >= 16, s"expected 16 bytes: ${bb.capacity()} / ${bb.limit()}") 39 | 40 | new UUID(bb.getLong, bb.getLong) 41 | } 42 | 43 | def bytesToUuid(bs: ByteString): UUID = { 44 | bytesToUuid(bs.asReadOnlyByteBuffer()) 45 | } 46 | 47 | def instantToLong(v: Instant) = v.toEpochMilli 48 | 49 | def longToInstance(v: Long) = Instant.ofEpochMilli(v) 50 | 51 | } 52 | -------------------------------------------------------------------------------- /scala-serialization/src/main/scala/com/komanov/serialization/converters/EventConverter.scala: -------------------------------------------------------------------------------- 1 | package com.komanov.serialization.converters 2 | 3 | import com.komanov.serialization.domain.{SiteEvent, SiteEventData} 4 | 5 | trait EventConverter { 6 | 7 | def toByteArray(event: SiteEvent): Array[Byte] 8 | 9 | def siteEventFromByteArray(clazz: Class[_], bytes: Array[Byte]): SiteEvent 10 | 11 | } 12 | -------------------------------------------------------------------------------- /scala-serialization/src/main/scala/com/komanov/serialization/converters/IoUtils.scala: -------------------------------------------------------------------------------- 1 | package com.komanov.serialization.converters 2 | 3 | object IoUtils { 4 | 5 | def using[T <: AutoCloseable, K](stream: => T)(f: T => K): K = { 6 | var s = null.asInstanceOf[T] 7 | try { 8 | s = stream 9 | f(s) 10 | } finally { 11 | if (s != null) { 12 | s.close() 13 | } 14 | } 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /scala-serialization/src/main/scala/com/komanov/serialization/converters/JavaSerializationConverter.scala: -------------------------------------------------------------------------------- 1 | package com.komanov.serialization.converters 2 | 3 | import java.io.{ByteArrayInputStream, ByteArrayOutputStream, ObjectInputStream, ObjectOutputStream} 4 | 5 | import com.komanov.serialization.converters.IoUtils.using 6 | import com.komanov.serialization.domain.{Site, SiteEvent, SiteEventData} 7 | 8 | object JavaSerializationConverter extends MyConverter { 9 | 10 | override def toByteArray(site: Site): Array[Byte] = { 11 | using(new ByteArrayOutputStream()) { baos => 12 | using(new ObjectOutputStream(baos)) { os => 13 | os.writeObject(site) 14 | os.flush() 15 | baos.toByteArray 16 | } 17 | } 18 | } 19 | 20 | override def fromByteArray(bytes: Array[Byte]): Site = { 21 | using(new ByteArrayInputStream(bytes)) { bais => 22 | using(new ObjectInputStream(bais)) { os => 23 | os.readObject().asInstanceOf[Site] 24 | } 25 | } 26 | } 27 | 28 | override def toByteArray(event: SiteEvent): Array[Byte] = { 29 | using(new ByteArrayOutputStream()) { baos => 30 | using(new ObjectOutputStream(baos)) { os => 31 | os.writeObject(event) 32 | os.flush() 33 | baos.toByteArray 34 | } 35 | } 36 | } 37 | 38 | override def siteEventFromByteArray(clazz: Class[_], bytes: Array[Byte]): SiteEvent = { 39 | using(new ByteArrayInputStream(bytes)) { bais => 40 | using(new ObjectInputStream(bais)) { os => 41 | os.readObject().asInstanceOf[SiteEvent] 42 | } 43 | } 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /scala-serialization/src/main/scala/com/komanov/serialization/converters/JsonConverter.scala: -------------------------------------------------------------------------------- 1 | package com.komanov.serialization.converters 2 | 3 | import java.time.Instant 4 | 5 | import com.fasterxml.jackson.core.{JsonGenerator, JsonParser, Version} 6 | import com.fasterxml.jackson.databind.Module.SetupContext 7 | import com.fasterxml.jackson.databind._ 8 | import com.fasterxml.jackson.databind.module.{SimpleDeserializers, SimpleSerializers} 9 | import com.fasterxml.jackson.module.scala.DefaultScalaModule 10 | import com.komanov.serialization.domain.{Site, SiteEvent, SiteEventData} 11 | 12 | /** https://github.com/FasterXML/jackson */ 13 | object JsonConverter extends MyConverter { 14 | 15 | private object InstantModule extends Module { 16 | override def getModuleName: String = "Instant" 17 | 18 | override def setupModule(context: SetupContext): Unit = { 19 | val serializers = new SimpleSerializers 20 | serializers.addSerializer(classOf[Instant], new JsonSerializer[Instant] { 21 | override def serialize(value: Instant, gen: JsonGenerator, serializers: SerializerProvider): Unit = { 22 | gen.writeNumber(value.toEpochMilli) 23 | } 24 | }) 25 | 26 | val deserializers = new SimpleDeserializers 27 | deserializers.addDeserializer(classOf[Instant], new JsonDeserializer[Instant] { 28 | override def deserialize(p: JsonParser, ctxt: DeserializationContext): Instant = { 29 | Instant.ofEpochMilli(p.getLongValue) 30 | } 31 | }) 32 | 33 | context.addSerializers(serializers) 34 | context.addDeserializers(deserializers) 35 | } 36 | 37 | override def version(): Version = new Version(1, 0, 0, "RELEASE", "group", "artifact") 38 | } 39 | 40 | private val objectMapper = { 41 | val om = new ObjectMapper() 42 | om.registerModule(new DefaultScalaModule) 43 | om.registerModule(InstantModule) 44 | om 45 | } 46 | private val siteReader: ObjectReader = objectMapper.readerFor(classOf[Site]) 47 | private val siteWriter: ObjectWriter = objectMapper.writerFor(classOf[Site]) 48 | 49 | override def toByteArray(site: Site): Array[Byte] = { 50 | siteWriter.writeValueAsBytes(site) 51 | } 52 | 53 | override def fromByteArray(bytes: Array[Byte]): Site = { 54 | siteReader.readValue(bytes) 55 | } 56 | 57 | override def toByteArray(event: SiteEvent): Array[Byte] = { 58 | objectMapper.writeValueAsBytes(event) 59 | } 60 | 61 | override def siteEventFromByteArray(clazz: Class[_], bytes: Array[Byte]): SiteEvent = { 62 | objectMapper.readValue(bytes, clazz).asInstanceOf[SiteEvent] 63 | } 64 | 65 | } 66 | -------------------------------------------------------------------------------- /scala-serialization/src/main/scala/com/komanov/serialization/converters/MyConverter.scala: -------------------------------------------------------------------------------- 1 | package com.komanov.serialization.converters 2 | 3 | trait MyConverter 4 | extends SiteConverter 5 | with EventConverter 6 | -------------------------------------------------------------------------------- /scala-serialization/src/main/scala/com/komanov/serialization/converters/PicklingConverter.scala: -------------------------------------------------------------------------------- 1 | package com.komanov.serialization.converters 2 | 3 | import com.komanov.serialization.converters.pickling._ 4 | import com.komanov.serialization.domain._ 5 | 6 | import scala.pickling.Defaults._ 7 | import scala.pickling._ 8 | import scala.pickling.binary._ 9 | import scala.pickling.shareNothing._ 10 | import scala.pickling.static._ 11 | 12 | /** https://github.com/scala/pickling */ 13 | object PicklingConverter extends MyConverter { 14 | 15 | override def toByteArray(site: Site): Array[Byte] = { 16 | site.pickle.value 17 | } 18 | 19 | override def fromByteArray(bytes: Array[Byte]): Site = { 20 | bytes.unpickle[Site] 21 | } 22 | 23 | override def toByteArray(event: SiteEvent): Array[Byte] = { 24 | event.pickle.value 25 | } 26 | 27 | override def siteEventFromByteArray(clazz: Class[_], bytes: Array[Byte]): SiteEvent = { 28 | bytes.unpickle[SiteEvent] 29 | } 30 | 31 | private implicit val pageComponentTypePickler = new JavaEnumPickler[PageComponentType] 32 | private implicit val siteFlagPickler = new JavaEnumPickler[SiteFlag] 33 | private implicit val siteTypePickler = new JavaEnumPickler[SiteType] 34 | 35 | private implicit val domainPickler = PicklerUnpickler.generate[Domain] 36 | private implicit val metaTagPickler = PicklerUnpickler.generate[MetaTag] 37 | private implicit val textComponentDataPickler = PicklerUnpickler.generate[TextComponentData] 38 | private implicit val buttonComponentDataPickler = PicklerUnpickler.generate[ButtonComponentData] 39 | private implicit val blogComponentDataPickler = PicklerUnpickler.generate[BlogComponentData] 40 | private implicit val pageComponentDataPickler = PicklerUnpickler.generate[PageComponentData] 41 | private implicit val pageComponentPositionPickler = PicklerUnpickler.generate[PageComponentPosition] 42 | private implicit val pageComponentPickler = PicklerUnpickler.generate[PageComponent] 43 | private implicit val pagePickler = PicklerUnpickler.generate[Page] 44 | private implicit val domainEntryPointPickler = PicklerUnpickler.generate[DomainEntryPoint] 45 | private implicit val freeEntryPointPickler = PicklerUnpickler.generate[FreeEntryPoint] 46 | private implicit val entryPointPickler = PicklerUnpickler.generate[EntryPoint] 47 | private implicit val sitePickler = PicklerUnpickler.generate[Site] 48 | 49 | private implicit val siteEventPickler = PicklerUnpickler.generate[SiteEvent] 50 | private implicit val siteEventDataPickler = PicklerUnpickler.generate[SiteEventData] 51 | } 52 | -------------------------------------------------------------------------------- /scala-serialization/src/main/scala/com/komanov/serialization/converters/ReflectionUtils.scala: -------------------------------------------------------------------------------- 1 | package com.komanov.serialization.converters 2 | 3 | object ReflectionUtils { 4 | 5 | def getCompanionObject(clazz: Class[_]): Any = { 6 | import scala.reflect.runtime.{currentMirror => cm} 7 | val classSymbol = cm.classSymbol(clazz) 8 | val moduleSymbol = classSymbol.companion.asModule 9 | val moduleMirror = cm.reflectModule(moduleSymbol) 10 | moduleMirror.instance 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /scala-serialization/src/main/scala/com/komanov/serialization/converters/SiteConverter.scala: -------------------------------------------------------------------------------- 1 | package com.komanov.serialization.converters 2 | 3 | import com.komanov.serialization.domain.Site 4 | 5 | trait SiteConverter { 6 | 7 | def toByteArray(site: Site): Array[Byte] 8 | 9 | def fromByteArray(bytes: Array[Byte]): Site 10 | 11 | } 12 | -------------------------------------------------------------------------------- /scala-serialization/src/main/scala/com/komanov/serialization/converters/pickling/package.scala: -------------------------------------------------------------------------------- 1 | package com.komanov.serialization.converters 2 | 3 | import java.time.Instant 4 | import java.util.UUID 5 | 6 | import com.komanov.serialization.domain.SiteType 7 | 8 | import scala.pickling.Defaults._ 9 | import scala.pickling.{FastTypeTag, _} 10 | import scala.reflect.ClassTag 11 | 12 | package object pickling { 13 | 14 | implicit class RichBuilder(val builder: PBuilder) extends AnyVal { 15 | def writeValue[T](name: String, f: => T, p: Pickler[T]) = { 16 | builder.putField(name, p.pickle(f, _)) 17 | } 18 | } 19 | 20 | implicit class RichReader(val reader: PReader) extends AnyVal { 21 | def readValue[T](name: String, unpickler: Unpickler[T]): T = { 22 | unpickler.unpickleEntry(reader.readField(name)).asInstanceOf[T] 23 | } 24 | 25 | def readValue[T](name: String, setter: T => Unit, unpickler: Unpickler[T]): Unit = { 26 | setter(readValue(name, unpickler)) 27 | } 28 | } 29 | 30 | implicit def optionPickler[T: FastTypeTag](implicit pickler: Pickler[T], unpickler: Unpickler[T]): Pickler[Option[T]] with Unpickler[Option[T]] = new AbstractPicklerUnpickler[Option[T]] { 31 | override def tag = implicitly[FastTypeTag[Option[T]]] 32 | 33 | override def pickle(v: Option[T], builder: PBuilder): Unit = { 34 | builder.beginEntry(v, tag) 35 | if (v.isEmpty) { 36 | Defaults.nullPickler.pickle(null, builder) 37 | } else { 38 | pickler.pickle(v.get, builder) 39 | } 40 | builder.endEntry() 41 | } 42 | 43 | override def unpickle(tag: String, reader: PReader): Any = { 44 | if (tag == FastTypeTag.Null.key) { 45 | None 46 | } else { 47 | Option(unpickler.unpickleEntry(reader)) 48 | } 49 | } 50 | } 51 | 52 | class NullPickler[T: FastTypeTag] extends AbstractPicklerUnpickler[T] { 53 | override def unpickle(tag: String, reader: PReader): Any = { 54 | null 55 | } 56 | 57 | override def tag: FastTypeTag[T] = implicitly[FastTypeTag[T]] 58 | 59 | override def pickle(v: T, builder: PBuilder): Unit = { 60 | builder.beginEntry(v, tag) 61 | builder.endEntry() 62 | } 63 | } 64 | 65 | abstract class PicklerUnpicklerBase[T] extends AbstractPicklerUnpickler[T] { 66 | final override def pickle(v: T, builder: PBuilder): Unit = { 67 | builder.beginEntry(v, tag) 68 | pickleInternal(v, builder) 69 | builder.endEntry() 70 | } 71 | 72 | protected def pickleInternal(v: T, builder: PBuilder): Unit 73 | } 74 | 75 | implicit object UuidPickler extends PicklerUnpicklerBase[UUID] { 76 | override def tag: FastTypeTag[UUID] = FastTypeTag[UUID] 77 | 78 | override protected def pickleInternal(v: UUID, builder: PBuilder): Unit = { 79 | builder.writeValue("m", v.getMostSignificantBits, longPickler) 80 | builder.writeValue("l", v.getLeastSignificantBits, longPickler) 81 | } 82 | 83 | override def unpickle(tag: String, reader: PReader): Any = { 84 | new UUID( 85 | reader.readValue("m", longPickler), 86 | reader.readValue("l", longPickler) 87 | ) 88 | } 89 | } 90 | 91 | class JavaEnumPickler[T <: Enum[T] : ClassTag : FastTypeTag] extends PicklerUnpicklerBase[T] { 92 | override def tag = implicitly[FastTypeTag[T]] 93 | 94 | override protected def pickleInternal(v: T, builder: PBuilder): Unit = { 95 | builder.writeValue("x", v.toString, stringPickler) 96 | } 97 | 98 | override def unpickle(tag: String, reader: PReader): Any = { 99 | val id = reader.readValue("x", stringPickler) 100 | val clazz = implicitly[ClassTag[T]].runtimeClass 101 | // Hack to fck compiler 102 | Enum.valueOf(clazz.asInstanceOf[Class[SiteType]], id) 103 | } 104 | } 105 | 106 | implicit object dateTimePickler extends PicklerUnpicklerBase[Instant] { 107 | override def tag = FastTypeTag[Instant] 108 | 109 | override protected def pickleInternal(v: Instant, builder: PBuilder): Unit = { 110 | builder.writeValue("x", v.toEpochMilli, longPickler) 111 | } 112 | 113 | override def unpickle(tag: String, reader: PReader): Any = { 114 | Instant.ofEpochMilli(reader.readValue("x", longPickler)) 115 | } 116 | } 117 | 118 | } 119 | -------------------------------------------------------------------------------- /scala-serialization/src/main/scala/com/komanov/serialization/domain/Site.scala: -------------------------------------------------------------------------------- 1 | package com.komanov.serialization.domain 2 | 3 | import java.time.Instant 4 | import java.util.UUID 5 | 6 | import com.fasterxml.jackson.annotation.{JsonSubTypes, JsonTypeInfo} 7 | 8 | import scala.pickling.directSubclasses 9 | 10 | 11 | case class Domain(name: String, 12 | primary: Boolean) 13 | 14 | 15 | case class MetaTag(name: String, 16 | value: String) 17 | 18 | 19 | @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") 20 | @JsonSubTypes(Array( 21 | new JsonSubTypes.Type(value = classOf[DomainEntryPoint], name = "DomainEntryPoint"), 22 | new JsonSubTypes.Type(value = classOf[FreeEntryPoint], name = "FreeEntryPoint") 23 | )) 24 | @directSubclasses(Array( 25 | classOf[DomainEntryPoint], 26 | classOf[FreeEntryPoint] 27 | )) 28 | sealed trait EntryPoint { 29 | def lookupKey: String 30 | 31 | def primary: Boolean 32 | } 33 | 34 | final case class DomainEntryPoint(domain: String, primary: Boolean) extends EntryPoint { 35 | override def lookupKey: String = domain 36 | } 37 | 38 | final case class FreeEntryPoint(userName: String, siteName: String, primary: Boolean) extends EntryPoint { 39 | override def lookupKey: String = s"$userName.wix.com/$siteName" 40 | } 41 | 42 | 43 | @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") 44 | @JsonSubTypes(Array( 45 | new JsonSubTypes.Type(value = classOf[TextComponentData], name = "TextComponentData"), 46 | new JsonSubTypes.Type(value = classOf[ButtonComponentData], name = "ButtonComponentData"), 47 | new JsonSubTypes.Type(value = classOf[BlogComponentData], name = "BlogComponentData") 48 | )) 49 | @directSubclasses(Array( 50 | classOf[TextComponentData], 51 | classOf[ButtonComponentData], 52 | classOf[BlogComponentData] 53 | )) 54 | sealed trait PageComponentData 55 | 56 | final case class TextComponentData(text: String) extends PageComponentData 57 | 58 | final case class ButtonComponentData(name: String, 59 | text: String, 60 | action: UUID) extends PageComponentData 61 | 62 | final case class BlogComponentData(name: String, 63 | rss: Boolean, 64 | tags: Boolean) extends PageComponentData 65 | 66 | 67 | case class PageComponentPosition(x: Int, 68 | y: Int) 69 | 70 | case class PageComponent(id: UUID, 71 | componentType: PageComponentType, 72 | data: PageComponentData, 73 | position: Option[PageComponentPosition], 74 | dateCreated: Instant, 75 | dateUpdated: Instant) 76 | 77 | 78 | case class Page(name: String, 79 | path: String, 80 | metaTags: Seq[MetaTag], 81 | components: Seq[PageComponent]) 82 | 83 | 84 | case class Site(id: UUID, 85 | ownerId: UUID, 86 | revision: Long, 87 | siteType: SiteType, 88 | flags: Seq[SiteFlag], 89 | name: String, 90 | description: String, 91 | domains: Seq[Domain], 92 | defaultMetaTags: Seq[MetaTag], 93 | pages: Seq[Page], 94 | entryPoints: Seq[EntryPoint], 95 | published: Boolean, 96 | dateCreated: Instant, 97 | dateUpdated: Instant) 98 | -------------------------------------------------------------------------------- /scala-serialization/src/main/scala/com/komanov/serialization/domain/protos/events/DefaultMetaTagAddedPb.scala: -------------------------------------------------------------------------------- 1 | // Generated by the Scala Plugin for the Protocol Buffer Compiler. 2 | // Do not edit! 3 | // 4 | // Protofile syntax: PROTO3 5 | 6 | package com.komanov.serialization.domain.protos.events 7 | 8 | 9 | 10 | @SerialVersionUID(0L) 11 | final case class DefaultMetaTagAddedPb( 12 | name: String = "", 13 | value: String = "" 14 | ) extends com.trueaccord.scalapb.GeneratedMessage with com.trueaccord.scalapb.Message[DefaultMetaTagAddedPb] with com.trueaccord.lenses.Updatable[DefaultMetaTagAddedPb] { 15 | @transient 16 | private[this] var __serializedSizeCachedValue: Int = 0 17 | private[this] def __computeSerializedValue(): Int = { 18 | var __size = 0 19 | if (name != "") { __size += com.google.protobuf.CodedOutputStream.computeStringSize(1, name) } 20 | if (value != "") { __size += com.google.protobuf.CodedOutputStream.computeStringSize(2, value) } 21 | __size 22 | } 23 | final override def serializedSize: Int = { 24 | var read = __serializedSizeCachedValue 25 | if (read == 0) { 26 | read = __computeSerializedValue() 27 | __serializedSizeCachedValue = read 28 | } 29 | read 30 | } 31 | def writeTo(output: com.google.protobuf.CodedOutputStream): Unit = { 32 | { 33 | val __v = name 34 | if (__v != "") { 35 | output.writeString(1, __v) 36 | } 37 | }; 38 | { 39 | val __v = value 40 | if (__v != "") { 41 | output.writeString(2, __v) 42 | } 43 | }; 44 | } 45 | def mergeFrom(__input: com.google.protobuf.CodedInputStream): com.komanov.serialization.domain.protos.events.DefaultMetaTagAddedPb = { 46 | var __name = this.name 47 | var __value = this.value 48 | var _done__ = false 49 | while (!_done__) { 50 | val _tag__ = __input.readTag() 51 | _tag__ match { 52 | case 0 => _done__ = true 53 | case 10 => 54 | __name = __input.readString() 55 | case 18 => 56 | __value = __input.readString() 57 | case tag => __input.skipField(tag) 58 | } 59 | } 60 | com.komanov.serialization.domain.protos.events.DefaultMetaTagAddedPb( 61 | name = __name, 62 | value = __value 63 | ) 64 | } 65 | def withName(__v: String): DefaultMetaTagAddedPb = copy(name = __v) 66 | def withValue(__v: String): DefaultMetaTagAddedPb = copy(value = __v) 67 | def getField(__field: com.google.protobuf.Descriptors.FieldDescriptor): scala.Any = { 68 | __field.getNumber match { 69 | case 1 => { 70 | val __t = name 71 | if (__t != "") __t else null 72 | } 73 | case 2 => { 74 | val __t = value 75 | if (__t != "") __t else null 76 | } 77 | } 78 | } 79 | override def toString: String = com.trueaccord.scalapb.TextFormat.printToUnicodeString(this) 80 | def companion = com.komanov.serialization.domain.protos.events.DefaultMetaTagAddedPb 81 | } 82 | 83 | object DefaultMetaTagAddedPb extends com.trueaccord.scalapb.GeneratedMessageCompanion[DefaultMetaTagAddedPb] { 84 | implicit def messageCompanion: com.trueaccord.scalapb.GeneratedMessageCompanion[DefaultMetaTagAddedPb] = this 85 | def fromFieldsMap(__fieldsMap: Map[com.google.protobuf.Descriptors.FieldDescriptor, scala.Any]): com.komanov.serialization.domain.protos.events.DefaultMetaTagAddedPb = { 86 | require(__fieldsMap.keys.forall(_.getContainingType() == descriptor), "FieldDescriptor does not match message type.") 87 | val __fields = descriptor.getFields 88 | com.komanov.serialization.domain.protos.events.DefaultMetaTagAddedPb( 89 | __fieldsMap.getOrElse(__fields.get(0), "").asInstanceOf[String], 90 | __fieldsMap.getOrElse(__fields.get(1), "").asInstanceOf[String] 91 | ) 92 | } 93 | def descriptor: com.google.protobuf.Descriptors.Descriptor = EventsProto.descriptor.getMessageTypes.get(11) 94 | def messageCompanionForField(__field: com.google.protobuf.Descriptors.FieldDescriptor): com.trueaccord.scalapb.GeneratedMessageCompanion[_] = throw new MatchError(__field) 95 | def enumCompanionForField(__field: com.google.protobuf.Descriptors.FieldDescriptor): com.trueaccord.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__field) 96 | lazy val defaultInstance = com.komanov.serialization.domain.protos.events.DefaultMetaTagAddedPb( 97 | ) 98 | implicit class DefaultMetaTagAddedPbLens[UpperPB](_l: com.trueaccord.lenses.Lens[UpperPB, DefaultMetaTagAddedPb]) extends com.trueaccord.lenses.ObjectLens[UpperPB, DefaultMetaTagAddedPb](_l) { 99 | def name: com.trueaccord.lenses.Lens[UpperPB, String] = field(_.name)((c_, f_) => c_.copy(name = f_)) 100 | def value: com.trueaccord.lenses.Lens[UpperPB, String] = field(_.value)((c_, f_) => c_.copy(value = f_)) 101 | } 102 | final val NAME_FIELD_NUMBER = 1 103 | final val VALUE_FIELD_NUMBER = 2 104 | } 105 | -------------------------------------------------------------------------------- /scala-serialization/src/main/scala/com/komanov/serialization/domain/protos/events/DefaultMetaTagRemovedPb.scala: -------------------------------------------------------------------------------- 1 | // Generated by the Scala Plugin for the Protocol Buffer Compiler. 2 | // Do not edit! 3 | // 4 | // Protofile syntax: PROTO3 5 | 6 | package com.komanov.serialization.domain.protos.events 7 | 8 | 9 | 10 | @SerialVersionUID(0L) 11 | final case class DefaultMetaTagRemovedPb( 12 | name: String = "" 13 | ) extends com.trueaccord.scalapb.GeneratedMessage with com.trueaccord.scalapb.Message[DefaultMetaTagRemovedPb] with com.trueaccord.lenses.Updatable[DefaultMetaTagRemovedPb] { 14 | @transient 15 | private[this] var __serializedSizeCachedValue: Int = 0 16 | private[this] def __computeSerializedValue(): Int = { 17 | var __size = 0 18 | if (name != "") { __size += com.google.protobuf.CodedOutputStream.computeStringSize(1, name) } 19 | __size 20 | } 21 | final override def serializedSize: Int = { 22 | var read = __serializedSizeCachedValue 23 | if (read == 0) { 24 | read = __computeSerializedValue() 25 | __serializedSizeCachedValue = read 26 | } 27 | read 28 | } 29 | def writeTo(output: com.google.protobuf.CodedOutputStream): Unit = { 30 | { 31 | val __v = name 32 | if (__v != "") { 33 | output.writeString(1, __v) 34 | } 35 | }; 36 | } 37 | def mergeFrom(__input: com.google.protobuf.CodedInputStream): com.komanov.serialization.domain.protos.events.DefaultMetaTagRemovedPb = { 38 | var __name = this.name 39 | var _done__ = false 40 | while (!_done__) { 41 | val _tag__ = __input.readTag() 42 | _tag__ match { 43 | case 0 => _done__ = true 44 | case 10 => 45 | __name = __input.readString() 46 | case tag => __input.skipField(tag) 47 | } 48 | } 49 | com.komanov.serialization.domain.protos.events.DefaultMetaTagRemovedPb( 50 | name = __name 51 | ) 52 | } 53 | def withName(__v: String): DefaultMetaTagRemovedPb = copy(name = __v) 54 | def getField(__field: com.google.protobuf.Descriptors.FieldDescriptor): scala.Any = { 55 | __field.getNumber match { 56 | case 1 => { 57 | val __t = name 58 | if (__t != "") __t else null 59 | } 60 | } 61 | } 62 | override def toString: String = com.trueaccord.scalapb.TextFormat.printToUnicodeString(this) 63 | def companion = com.komanov.serialization.domain.protos.events.DefaultMetaTagRemovedPb 64 | } 65 | 66 | object DefaultMetaTagRemovedPb extends com.trueaccord.scalapb.GeneratedMessageCompanion[DefaultMetaTagRemovedPb] { 67 | implicit def messageCompanion: com.trueaccord.scalapb.GeneratedMessageCompanion[DefaultMetaTagRemovedPb] = this 68 | def fromFieldsMap(__fieldsMap: Map[com.google.protobuf.Descriptors.FieldDescriptor, scala.Any]): com.komanov.serialization.domain.protos.events.DefaultMetaTagRemovedPb = { 69 | require(__fieldsMap.keys.forall(_.getContainingType() == descriptor), "FieldDescriptor does not match message type.") 70 | val __fields = descriptor.getFields 71 | com.komanov.serialization.domain.protos.events.DefaultMetaTagRemovedPb( 72 | __fieldsMap.getOrElse(__fields.get(0), "").asInstanceOf[String] 73 | ) 74 | } 75 | def descriptor: com.google.protobuf.Descriptors.Descriptor = EventsProto.descriptor.getMessageTypes.get(12) 76 | def messageCompanionForField(__field: com.google.protobuf.Descriptors.FieldDescriptor): com.trueaccord.scalapb.GeneratedMessageCompanion[_] = throw new MatchError(__field) 77 | def enumCompanionForField(__field: com.google.protobuf.Descriptors.FieldDescriptor): com.trueaccord.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__field) 78 | lazy val defaultInstance = com.komanov.serialization.domain.protos.events.DefaultMetaTagRemovedPb( 79 | ) 80 | implicit class DefaultMetaTagRemovedPbLens[UpperPB](_l: com.trueaccord.lenses.Lens[UpperPB, DefaultMetaTagRemovedPb]) extends com.trueaccord.lenses.ObjectLens[UpperPB, DefaultMetaTagRemovedPb](_l) { 81 | def name: com.trueaccord.lenses.Lens[UpperPB, String] = field(_.name)((c_, f_) => c_.copy(name = f_)) 82 | } 83 | final val NAME_FIELD_NUMBER = 1 84 | } 85 | -------------------------------------------------------------------------------- /scala-serialization/src/main/scala/com/komanov/serialization/domain/protos/events/DomainAddedPb.scala: -------------------------------------------------------------------------------- 1 | // Generated by the Scala Plugin for the Protocol Buffer Compiler. 2 | // Do not edit! 3 | // 4 | // Protofile syntax: PROTO3 5 | 6 | package com.komanov.serialization.domain.protos.events 7 | 8 | 9 | 10 | @SerialVersionUID(0L) 11 | final case class DomainAddedPb( 12 | name: String = "" 13 | ) extends com.trueaccord.scalapb.GeneratedMessage with com.trueaccord.scalapb.Message[DomainAddedPb] with com.trueaccord.lenses.Updatable[DomainAddedPb] { 14 | @transient 15 | private[this] var __serializedSizeCachedValue: Int = 0 16 | private[this] def __computeSerializedValue(): Int = { 17 | var __size = 0 18 | if (name != "") { __size += com.google.protobuf.CodedOutputStream.computeStringSize(1, name) } 19 | __size 20 | } 21 | final override def serializedSize: Int = { 22 | var read = __serializedSizeCachedValue 23 | if (read == 0) { 24 | read = __computeSerializedValue() 25 | __serializedSizeCachedValue = read 26 | } 27 | read 28 | } 29 | def writeTo(output: com.google.protobuf.CodedOutputStream): Unit = { 30 | { 31 | val __v = name 32 | if (__v != "") { 33 | output.writeString(1, __v) 34 | } 35 | }; 36 | } 37 | def mergeFrom(__input: com.google.protobuf.CodedInputStream): com.komanov.serialization.domain.protos.events.DomainAddedPb = { 38 | var __name = this.name 39 | var _done__ = false 40 | while (!_done__) { 41 | val _tag__ = __input.readTag() 42 | _tag__ match { 43 | case 0 => _done__ = true 44 | case 10 => 45 | __name = __input.readString() 46 | case tag => __input.skipField(tag) 47 | } 48 | } 49 | com.komanov.serialization.domain.protos.events.DomainAddedPb( 50 | name = __name 51 | ) 52 | } 53 | def withName(__v: String): DomainAddedPb = copy(name = __v) 54 | def getField(__field: com.google.protobuf.Descriptors.FieldDescriptor): scala.Any = { 55 | __field.getNumber match { 56 | case 1 => { 57 | val __t = name 58 | if (__t != "") __t else null 59 | } 60 | } 61 | } 62 | override def toString: String = com.trueaccord.scalapb.TextFormat.printToUnicodeString(this) 63 | def companion = com.komanov.serialization.domain.protos.events.DomainAddedPb 64 | } 65 | 66 | object DomainAddedPb extends com.trueaccord.scalapb.GeneratedMessageCompanion[DomainAddedPb] { 67 | implicit def messageCompanion: com.trueaccord.scalapb.GeneratedMessageCompanion[DomainAddedPb] = this 68 | def fromFieldsMap(__fieldsMap: Map[com.google.protobuf.Descriptors.FieldDescriptor, scala.Any]): com.komanov.serialization.domain.protos.events.DomainAddedPb = { 69 | require(__fieldsMap.keys.forall(_.getContainingType() == descriptor), "FieldDescriptor does not match message type.") 70 | val __fields = descriptor.getFields 71 | com.komanov.serialization.domain.protos.events.DomainAddedPb( 72 | __fieldsMap.getOrElse(__fields.get(0), "").asInstanceOf[String] 73 | ) 74 | } 75 | def descriptor: com.google.protobuf.Descriptors.Descriptor = EventsProto.descriptor.getMessageTypes.get(8) 76 | def messageCompanionForField(__field: com.google.protobuf.Descriptors.FieldDescriptor): com.trueaccord.scalapb.GeneratedMessageCompanion[_] = throw new MatchError(__field) 77 | def enumCompanionForField(__field: com.google.protobuf.Descriptors.FieldDescriptor): com.trueaccord.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__field) 78 | lazy val defaultInstance = com.komanov.serialization.domain.protos.events.DomainAddedPb( 79 | ) 80 | implicit class DomainAddedPbLens[UpperPB](_l: com.trueaccord.lenses.Lens[UpperPB, DomainAddedPb]) extends com.trueaccord.lenses.ObjectLens[UpperPB, DomainAddedPb](_l) { 81 | def name: com.trueaccord.lenses.Lens[UpperPB, String] = field(_.name)((c_, f_) => c_.copy(name = f_)) 82 | } 83 | final val NAME_FIELD_NUMBER = 1 84 | } 85 | -------------------------------------------------------------------------------- /scala-serialization/src/main/scala/com/komanov/serialization/domain/protos/events/DomainEntryPointAddedPb.scala: -------------------------------------------------------------------------------- 1 | // Generated by the Scala Plugin for the Protocol Buffer Compiler. 2 | // Do not edit! 3 | // 4 | // Protofile syntax: PROTO3 5 | 6 | package com.komanov.serialization.domain.protos.events 7 | 8 | 9 | 10 | @SerialVersionUID(0L) 11 | final case class DomainEntryPointAddedPb( 12 | domain: String = "" 13 | ) extends com.trueaccord.scalapb.GeneratedMessage with com.trueaccord.scalapb.Message[DomainEntryPointAddedPb] with com.trueaccord.lenses.Updatable[DomainEntryPointAddedPb] { 14 | @transient 15 | private[this] var __serializedSizeCachedValue: Int = 0 16 | private[this] def __computeSerializedValue(): Int = { 17 | var __size = 0 18 | if (domain != "") { __size += com.google.protobuf.CodedOutputStream.computeStringSize(1, domain) } 19 | __size 20 | } 21 | final override def serializedSize: Int = { 22 | var read = __serializedSizeCachedValue 23 | if (read == 0) { 24 | read = __computeSerializedValue() 25 | __serializedSizeCachedValue = read 26 | } 27 | read 28 | } 29 | def writeTo(output: com.google.protobuf.CodedOutputStream): Unit = { 30 | { 31 | val __v = domain 32 | if (__v != "") { 33 | output.writeString(1, __v) 34 | } 35 | }; 36 | } 37 | def mergeFrom(__input: com.google.protobuf.CodedInputStream): com.komanov.serialization.domain.protos.events.DomainEntryPointAddedPb = { 38 | var __domain = this.domain 39 | var _done__ = false 40 | while (!_done__) { 41 | val _tag__ = __input.readTag() 42 | _tag__ match { 43 | case 0 => _done__ = true 44 | case 10 => 45 | __domain = __input.readString() 46 | case tag => __input.skipField(tag) 47 | } 48 | } 49 | com.komanov.serialization.domain.protos.events.DomainEntryPointAddedPb( 50 | domain = __domain 51 | ) 52 | } 53 | def withDomain(__v: String): DomainEntryPointAddedPb = copy(domain = __v) 54 | def getField(__field: com.google.protobuf.Descriptors.FieldDescriptor): scala.Any = { 55 | __field.getNumber match { 56 | case 1 => { 57 | val __t = domain 58 | if (__t != "") __t else null 59 | } 60 | } 61 | } 62 | override def toString: String = com.trueaccord.scalapb.TextFormat.printToUnicodeString(this) 63 | def companion = com.komanov.serialization.domain.protos.events.DomainEntryPointAddedPb 64 | } 65 | 66 | object DomainEntryPointAddedPb extends com.trueaccord.scalapb.GeneratedMessageCompanion[DomainEntryPointAddedPb] { 67 | implicit def messageCompanion: com.trueaccord.scalapb.GeneratedMessageCompanion[DomainEntryPointAddedPb] = this 68 | def fromFieldsMap(__fieldsMap: Map[com.google.protobuf.Descriptors.FieldDescriptor, scala.Any]): com.komanov.serialization.domain.protos.events.DomainEntryPointAddedPb = { 69 | require(__fieldsMap.keys.forall(_.getContainingType() == descriptor), "FieldDescriptor does not match message type.") 70 | val __fields = descriptor.getFields 71 | com.komanov.serialization.domain.protos.events.DomainEntryPointAddedPb( 72 | __fieldsMap.getOrElse(__fields.get(0), "").asInstanceOf[String] 73 | ) 74 | } 75 | def descriptor: com.google.protobuf.Descriptors.Descriptor = EventsProto.descriptor.getMessageTypes.get(25) 76 | def messageCompanionForField(__field: com.google.protobuf.Descriptors.FieldDescriptor): com.trueaccord.scalapb.GeneratedMessageCompanion[_] = throw new MatchError(__field) 77 | def enumCompanionForField(__field: com.google.protobuf.Descriptors.FieldDescriptor): com.trueaccord.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__field) 78 | lazy val defaultInstance = com.komanov.serialization.domain.protos.events.DomainEntryPointAddedPb( 79 | ) 80 | implicit class DomainEntryPointAddedPbLens[UpperPB](_l: com.trueaccord.lenses.Lens[UpperPB, DomainEntryPointAddedPb]) extends com.trueaccord.lenses.ObjectLens[UpperPB, DomainEntryPointAddedPb](_l) { 81 | def domain: com.trueaccord.lenses.Lens[UpperPB, String] = field(_.domain)((c_, f_) => c_.copy(domain = f_)) 82 | } 83 | final val DOMAIN_FIELD_NUMBER = 1 84 | } 85 | -------------------------------------------------------------------------------- /scala-serialization/src/main/scala/com/komanov/serialization/domain/protos/events/DomainRemovedPb.scala: -------------------------------------------------------------------------------- 1 | // Generated by the Scala Plugin for the Protocol Buffer Compiler. 2 | // Do not edit! 3 | // 4 | // Protofile syntax: PROTO3 5 | 6 | package com.komanov.serialization.domain.protos.events 7 | 8 | 9 | 10 | @SerialVersionUID(0L) 11 | final case class DomainRemovedPb( 12 | name: String = "" 13 | ) extends com.trueaccord.scalapb.GeneratedMessage with com.trueaccord.scalapb.Message[DomainRemovedPb] with com.trueaccord.lenses.Updatable[DomainRemovedPb] { 14 | @transient 15 | private[this] var __serializedSizeCachedValue: Int = 0 16 | private[this] def __computeSerializedValue(): Int = { 17 | var __size = 0 18 | if (name != "") { __size += com.google.protobuf.CodedOutputStream.computeStringSize(1, name) } 19 | __size 20 | } 21 | final override def serializedSize: Int = { 22 | var read = __serializedSizeCachedValue 23 | if (read == 0) { 24 | read = __computeSerializedValue() 25 | __serializedSizeCachedValue = read 26 | } 27 | read 28 | } 29 | def writeTo(output: com.google.protobuf.CodedOutputStream): Unit = { 30 | { 31 | val __v = name 32 | if (__v != "") { 33 | output.writeString(1, __v) 34 | } 35 | }; 36 | } 37 | def mergeFrom(__input: com.google.protobuf.CodedInputStream): com.komanov.serialization.domain.protos.events.DomainRemovedPb = { 38 | var __name = this.name 39 | var _done__ = false 40 | while (!_done__) { 41 | val _tag__ = __input.readTag() 42 | _tag__ match { 43 | case 0 => _done__ = true 44 | case 10 => 45 | __name = __input.readString() 46 | case tag => __input.skipField(tag) 47 | } 48 | } 49 | com.komanov.serialization.domain.protos.events.DomainRemovedPb( 50 | name = __name 51 | ) 52 | } 53 | def withName(__v: String): DomainRemovedPb = copy(name = __v) 54 | def getField(__field: com.google.protobuf.Descriptors.FieldDescriptor): scala.Any = { 55 | __field.getNumber match { 56 | case 1 => { 57 | val __t = name 58 | if (__t != "") __t else null 59 | } 60 | } 61 | } 62 | override def toString: String = com.trueaccord.scalapb.TextFormat.printToUnicodeString(this) 63 | def companion = com.komanov.serialization.domain.protos.events.DomainRemovedPb 64 | } 65 | 66 | object DomainRemovedPb extends com.trueaccord.scalapb.GeneratedMessageCompanion[DomainRemovedPb] { 67 | implicit def messageCompanion: com.trueaccord.scalapb.GeneratedMessageCompanion[DomainRemovedPb] = this 68 | def fromFieldsMap(__fieldsMap: Map[com.google.protobuf.Descriptors.FieldDescriptor, scala.Any]): com.komanov.serialization.domain.protos.events.DomainRemovedPb = { 69 | require(__fieldsMap.keys.forall(_.getContainingType() == descriptor), "FieldDescriptor does not match message type.") 70 | val __fields = descriptor.getFields 71 | com.komanov.serialization.domain.protos.events.DomainRemovedPb( 72 | __fieldsMap.getOrElse(__fields.get(0), "").asInstanceOf[String] 73 | ) 74 | } 75 | def descriptor: com.google.protobuf.Descriptors.Descriptor = EventsProto.descriptor.getMessageTypes.get(9) 76 | def messageCompanionForField(__field: com.google.protobuf.Descriptors.FieldDescriptor): com.trueaccord.scalapb.GeneratedMessageCompanion[_] = throw new MatchError(__field) 77 | def enumCompanionForField(__field: com.google.protobuf.Descriptors.FieldDescriptor): com.trueaccord.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__field) 78 | lazy val defaultInstance = com.komanov.serialization.domain.protos.events.DomainRemovedPb( 79 | ) 80 | implicit class DomainRemovedPbLens[UpperPB](_l: com.trueaccord.lenses.Lens[UpperPB, DomainRemovedPb]) extends com.trueaccord.lenses.ObjectLens[UpperPB, DomainRemovedPb](_l) { 81 | def name: com.trueaccord.lenses.Lens[UpperPB, String] = field(_.name)((c_, f_) => c_.copy(name = f_)) 82 | } 83 | final val NAME_FIELD_NUMBER = 1 84 | } 85 | -------------------------------------------------------------------------------- /scala-serialization/src/main/scala/com/komanov/serialization/domain/protos/events/EntryPointRemovedPb.scala: -------------------------------------------------------------------------------- 1 | // Generated by the Scala Plugin for the Protocol Buffer Compiler. 2 | // Do not edit! 3 | // 4 | // Protofile syntax: PROTO3 5 | 6 | package com.komanov.serialization.domain.protos.events 7 | 8 | 9 | 10 | @SerialVersionUID(0L) 11 | final case class EntryPointRemovedPb( 12 | lookupKey: String = "" 13 | ) extends com.trueaccord.scalapb.GeneratedMessage with com.trueaccord.scalapb.Message[EntryPointRemovedPb] with com.trueaccord.lenses.Updatable[EntryPointRemovedPb] { 14 | @transient 15 | private[this] var __serializedSizeCachedValue: Int = 0 16 | private[this] def __computeSerializedValue(): Int = { 17 | var __size = 0 18 | if (lookupKey != "") { __size += com.google.protobuf.CodedOutputStream.computeStringSize(1, lookupKey) } 19 | __size 20 | } 21 | final override def serializedSize: Int = { 22 | var read = __serializedSizeCachedValue 23 | if (read == 0) { 24 | read = __computeSerializedValue() 25 | __serializedSizeCachedValue = read 26 | } 27 | read 28 | } 29 | def writeTo(output: com.google.protobuf.CodedOutputStream): Unit = { 30 | { 31 | val __v = lookupKey 32 | if (__v != "") { 33 | output.writeString(1, __v) 34 | } 35 | }; 36 | } 37 | def mergeFrom(__input: com.google.protobuf.CodedInputStream): com.komanov.serialization.domain.protos.events.EntryPointRemovedPb = { 38 | var __lookupKey = this.lookupKey 39 | var _done__ = false 40 | while (!_done__) { 41 | val _tag__ = __input.readTag() 42 | _tag__ match { 43 | case 0 => _done__ = true 44 | case 10 => 45 | __lookupKey = __input.readString() 46 | case tag => __input.skipField(tag) 47 | } 48 | } 49 | com.komanov.serialization.domain.protos.events.EntryPointRemovedPb( 50 | lookupKey = __lookupKey 51 | ) 52 | } 53 | def withLookupKey(__v: String): EntryPointRemovedPb = copy(lookupKey = __v) 54 | def getField(__field: com.google.protobuf.Descriptors.FieldDescriptor): scala.Any = { 55 | __field.getNumber match { 56 | case 1 => { 57 | val __t = lookupKey 58 | if (__t != "") __t else null 59 | } 60 | } 61 | } 62 | override def toString: String = com.trueaccord.scalapb.TextFormat.printToUnicodeString(this) 63 | def companion = com.komanov.serialization.domain.protos.events.EntryPointRemovedPb 64 | } 65 | 66 | object EntryPointRemovedPb extends com.trueaccord.scalapb.GeneratedMessageCompanion[EntryPointRemovedPb] { 67 | implicit def messageCompanion: com.trueaccord.scalapb.GeneratedMessageCompanion[EntryPointRemovedPb] = this 68 | def fromFieldsMap(__fieldsMap: Map[com.google.protobuf.Descriptors.FieldDescriptor, scala.Any]): com.komanov.serialization.domain.protos.events.EntryPointRemovedPb = { 69 | require(__fieldsMap.keys.forall(_.getContainingType() == descriptor), "FieldDescriptor does not match message type.") 70 | val __fields = descriptor.getFields 71 | com.komanov.serialization.domain.protos.events.EntryPointRemovedPb( 72 | __fieldsMap.getOrElse(__fields.get(0), "").asInstanceOf[String] 73 | ) 74 | } 75 | def descriptor: com.google.protobuf.Descriptors.Descriptor = EventsProto.descriptor.getMessageTypes.get(27) 76 | def messageCompanionForField(__field: com.google.protobuf.Descriptors.FieldDescriptor): com.trueaccord.scalapb.GeneratedMessageCompanion[_] = throw new MatchError(__field) 77 | def enumCompanionForField(__field: com.google.protobuf.Descriptors.FieldDescriptor): com.trueaccord.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__field) 78 | lazy val defaultInstance = com.komanov.serialization.domain.protos.events.EntryPointRemovedPb( 79 | ) 80 | implicit class EntryPointRemovedPbLens[UpperPB](_l: com.trueaccord.lenses.Lens[UpperPB, EntryPointRemovedPb]) extends com.trueaccord.lenses.ObjectLens[UpperPB, EntryPointRemovedPb](_l) { 81 | def lookupKey: com.trueaccord.lenses.Lens[UpperPB, String] = field(_.lookupKey)((c_, f_) => c_.copy(lookupKey = f_)) 82 | } 83 | final val LOOKUPKEY_FIELD_NUMBER = 1 84 | } 85 | -------------------------------------------------------------------------------- /scala-serialization/src/main/scala/com/komanov/serialization/domain/protos/events/FreeEntryPointAddedPb.scala: -------------------------------------------------------------------------------- 1 | // Generated by the Scala Plugin for the Protocol Buffer Compiler. 2 | // Do not edit! 3 | // 4 | // Protofile syntax: PROTO3 5 | 6 | package com.komanov.serialization.domain.protos.events 7 | 8 | 9 | 10 | @SerialVersionUID(0L) 11 | final case class FreeEntryPointAddedPb( 12 | userName: String = "", 13 | siteName: String = "" 14 | ) extends com.trueaccord.scalapb.GeneratedMessage with com.trueaccord.scalapb.Message[FreeEntryPointAddedPb] with com.trueaccord.lenses.Updatable[FreeEntryPointAddedPb] { 15 | @transient 16 | private[this] var __serializedSizeCachedValue: Int = 0 17 | private[this] def __computeSerializedValue(): Int = { 18 | var __size = 0 19 | if (userName != "") { __size += com.google.protobuf.CodedOutputStream.computeStringSize(1, userName) } 20 | if (siteName != "") { __size += com.google.protobuf.CodedOutputStream.computeStringSize(2, siteName) } 21 | __size 22 | } 23 | final override def serializedSize: Int = { 24 | var read = __serializedSizeCachedValue 25 | if (read == 0) { 26 | read = __computeSerializedValue() 27 | __serializedSizeCachedValue = read 28 | } 29 | read 30 | } 31 | def writeTo(output: com.google.protobuf.CodedOutputStream): Unit = { 32 | { 33 | val __v = userName 34 | if (__v != "") { 35 | output.writeString(1, __v) 36 | } 37 | }; 38 | { 39 | val __v = siteName 40 | if (__v != "") { 41 | output.writeString(2, __v) 42 | } 43 | }; 44 | } 45 | def mergeFrom(__input: com.google.protobuf.CodedInputStream): com.komanov.serialization.domain.protos.events.FreeEntryPointAddedPb = { 46 | var __userName = this.userName 47 | var __siteName = this.siteName 48 | var _done__ = false 49 | while (!_done__) { 50 | val _tag__ = __input.readTag() 51 | _tag__ match { 52 | case 0 => _done__ = true 53 | case 10 => 54 | __userName = __input.readString() 55 | case 18 => 56 | __siteName = __input.readString() 57 | case tag => __input.skipField(tag) 58 | } 59 | } 60 | com.komanov.serialization.domain.protos.events.FreeEntryPointAddedPb( 61 | userName = __userName, 62 | siteName = __siteName 63 | ) 64 | } 65 | def withUserName(__v: String): FreeEntryPointAddedPb = copy(userName = __v) 66 | def withSiteName(__v: String): FreeEntryPointAddedPb = copy(siteName = __v) 67 | def getField(__field: com.google.protobuf.Descriptors.FieldDescriptor): scala.Any = { 68 | __field.getNumber match { 69 | case 1 => { 70 | val __t = userName 71 | if (__t != "") __t else null 72 | } 73 | case 2 => { 74 | val __t = siteName 75 | if (__t != "") __t else null 76 | } 77 | } 78 | } 79 | override def toString: String = com.trueaccord.scalapb.TextFormat.printToUnicodeString(this) 80 | def companion = com.komanov.serialization.domain.protos.events.FreeEntryPointAddedPb 81 | } 82 | 83 | object FreeEntryPointAddedPb extends com.trueaccord.scalapb.GeneratedMessageCompanion[FreeEntryPointAddedPb] { 84 | implicit def messageCompanion: com.trueaccord.scalapb.GeneratedMessageCompanion[FreeEntryPointAddedPb] = this 85 | def fromFieldsMap(__fieldsMap: Map[com.google.protobuf.Descriptors.FieldDescriptor, scala.Any]): com.komanov.serialization.domain.protos.events.FreeEntryPointAddedPb = { 86 | require(__fieldsMap.keys.forall(_.getContainingType() == descriptor), "FieldDescriptor does not match message type.") 87 | val __fields = descriptor.getFields 88 | com.komanov.serialization.domain.protos.events.FreeEntryPointAddedPb( 89 | __fieldsMap.getOrElse(__fields.get(0), "").asInstanceOf[String], 90 | __fieldsMap.getOrElse(__fields.get(1), "").asInstanceOf[String] 91 | ) 92 | } 93 | def descriptor: com.google.protobuf.Descriptors.Descriptor = EventsProto.descriptor.getMessageTypes.get(26) 94 | def messageCompanionForField(__field: com.google.protobuf.Descriptors.FieldDescriptor): com.trueaccord.scalapb.GeneratedMessageCompanion[_] = throw new MatchError(__field) 95 | def enumCompanionForField(__field: com.google.protobuf.Descriptors.FieldDescriptor): com.trueaccord.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__field) 96 | lazy val defaultInstance = com.komanov.serialization.domain.protos.events.FreeEntryPointAddedPb( 97 | ) 98 | implicit class FreeEntryPointAddedPbLens[UpperPB](_l: com.trueaccord.lenses.Lens[UpperPB, FreeEntryPointAddedPb]) extends com.trueaccord.lenses.ObjectLens[UpperPB, FreeEntryPointAddedPb](_l) { 99 | def userName: com.trueaccord.lenses.Lens[UpperPB, String] = field(_.userName)((c_, f_) => c_.copy(userName = f_)) 100 | def siteName: com.trueaccord.lenses.Lens[UpperPB, String] = field(_.siteName)((c_, f_) => c_.copy(siteName = f_)) 101 | } 102 | final val USERNAME_FIELD_NUMBER = 1 103 | final val SITENAME_FIELD_NUMBER = 2 104 | } 105 | -------------------------------------------------------------------------------- /scala-serialization/src/main/scala/com/komanov/serialization/domain/protos/events/PageAddedPb.scala: -------------------------------------------------------------------------------- 1 | // Generated by the Scala Plugin for the Protocol Buffer Compiler. 2 | // Do not edit! 3 | // 4 | // Protofile syntax: PROTO3 5 | 6 | package com.komanov.serialization.domain.protos.events 7 | 8 | 9 | 10 | @SerialVersionUID(0L) 11 | final case class PageAddedPb( 12 | path: String = "" 13 | ) extends com.trueaccord.scalapb.GeneratedMessage with com.trueaccord.scalapb.Message[PageAddedPb] with com.trueaccord.lenses.Updatable[PageAddedPb] { 14 | @transient 15 | private[this] var __serializedSizeCachedValue: Int = 0 16 | private[this] def __computeSerializedValue(): Int = { 17 | var __size = 0 18 | if (path != "") { __size += com.google.protobuf.CodedOutputStream.computeStringSize(1, path) } 19 | __size 20 | } 21 | final override def serializedSize: Int = { 22 | var read = __serializedSizeCachedValue 23 | if (read == 0) { 24 | read = __computeSerializedValue() 25 | __serializedSizeCachedValue = read 26 | } 27 | read 28 | } 29 | def writeTo(output: com.google.protobuf.CodedOutputStream): Unit = { 30 | { 31 | val __v = path 32 | if (__v != "") { 33 | output.writeString(1, __v) 34 | } 35 | }; 36 | } 37 | def mergeFrom(__input: com.google.protobuf.CodedInputStream): com.komanov.serialization.domain.protos.events.PageAddedPb = { 38 | var __path = this.path 39 | var _done__ = false 40 | while (!_done__) { 41 | val _tag__ = __input.readTag() 42 | _tag__ match { 43 | case 0 => _done__ = true 44 | case 10 => 45 | __path = __input.readString() 46 | case tag => __input.skipField(tag) 47 | } 48 | } 49 | com.komanov.serialization.domain.protos.events.PageAddedPb( 50 | path = __path 51 | ) 52 | } 53 | def withPath(__v: String): PageAddedPb = copy(path = __v) 54 | def getField(__field: com.google.protobuf.Descriptors.FieldDescriptor): scala.Any = { 55 | __field.getNumber match { 56 | case 1 => { 57 | val __t = path 58 | if (__t != "") __t else null 59 | } 60 | } 61 | } 62 | override def toString: String = com.trueaccord.scalapb.TextFormat.printToUnicodeString(this) 63 | def companion = com.komanov.serialization.domain.protos.events.PageAddedPb 64 | } 65 | 66 | object PageAddedPb extends com.trueaccord.scalapb.GeneratedMessageCompanion[PageAddedPb] { 67 | implicit def messageCompanion: com.trueaccord.scalapb.GeneratedMessageCompanion[PageAddedPb] = this 68 | def fromFieldsMap(__fieldsMap: Map[com.google.protobuf.Descriptors.FieldDescriptor, scala.Any]): com.komanov.serialization.domain.protos.events.PageAddedPb = { 69 | require(__fieldsMap.keys.forall(_.getContainingType() == descriptor), "FieldDescriptor does not match message type.") 70 | val __fields = descriptor.getFields 71 | com.komanov.serialization.domain.protos.events.PageAddedPb( 72 | __fieldsMap.getOrElse(__fields.get(0), "").asInstanceOf[String] 73 | ) 74 | } 75 | def descriptor: com.google.protobuf.Descriptors.Descriptor = EventsProto.descriptor.getMessageTypes.get(13) 76 | def messageCompanionForField(__field: com.google.protobuf.Descriptors.FieldDescriptor): com.trueaccord.scalapb.GeneratedMessageCompanion[_] = throw new MatchError(__field) 77 | def enumCompanionForField(__field: com.google.protobuf.Descriptors.FieldDescriptor): com.trueaccord.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__field) 78 | lazy val defaultInstance = com.komanov.serialization.domain.protos.events.PageAddedPb( 79 | ) 80 | implicit class PageAddedPbLens[UpperPB](_l: com.trueaccord.lenses.Lens[UpperPB, PageAddedPb]) extends com.trueaccord.lenses.ObjectLens[UpperPB, PageAddedPb](_l) { 81 | def path: com.trueaccord.lenses.Lens[UpperPB, String] = field(_.path)((c_, f_) => c_.copy(path = f_)) 82 | } 83 | final val PATH_FIELD_NUMBER = 1 84 | } 85 | -------------------------------------------------------------------------------- /scala-serialization/src/main/scala/com/komanov/serialization/domain/protos/events/PageComponentPositionResetPb.scala: -------------------------------------------------------------------------------- 1 | // Generated by the Scala Plugin for the Protocol Buffer Compiler. 2 | // Do not edit! 3 | // 4 | // Protofile syntax: PROTO3 5 | 6 | package com.komanov.serialization.domain.protos.events 7 | 8 | 9 | 10 | @SerialVersionUID(0L) 11 | final case class PageComponentPositionResetPb( 12 | id: com.google.protobuf.ByteString = com.google.protobuf.ByteString.EMPTY 13 | ) extends com.trueaccord.scalapb.GeneratedMessage with com.trueaccord.scalapb.Message[PageComponentPositionResetPb] with com.trueaccord.lenses.Updatable[PageComponentPositionResetPb] { 14 | @transient 15 | private[this] var __serializedSizeCachedValue: Int = 0 16 | private[this] def __computeSerializedValue(): Int = { 17 | var __size = 0 18 | if (id != com.google.protobuf.ByteString.EMPTY) { __size += com.google.protobuf.CodedOutputStream.computeBytesSize(1, id) } 19 | __size 20 | } 21 | final override def serializedSize: Int = { 22 | var read = __serializedSizeCachedValue 23 | if (read == 0) { 24 | read = __computeSerializedValue() 25 | __serializedSizeCachedValue = read 26 | } 27 | read 28 | } 29 | def writeTo(output: com.google.protobuf.CodedOutputStream): Unit = { 30 | { 31 | val __v = id 32 | if (__v != com.google.protobuf.ByteString.EMPTY) { 33 | output.writeBytes(1, __v) 34 | } 35 | }; 36 | } 37 | def mergeFrom(__input: com.google.protobuf.CodedInputStream): com.komanov.serialization.domain.protos.events.PageComponentPositionResetPb = { 38 | var __id = this.id 39 | var _done__ = false 40 | while (!_done__) { 41 | val _tag__ = __input.readTag() 42 | _tag__ match { 43 | case 0 => _done__ = true 44 | case 10 => 45 | __id = __input.readBytes() 46 | case tag => __input.skipField(tag) 47 | } 48 | } 49 | com.komanov.serialization.domain.protos.events.PageComponentPositionResetPb( 50 | id = __id 51 | ) 52 | } 53 | def withId(__v: com.google.protobuf.ByteString): PageComponentPositionResetPb = copy(id = __v) 54 | def getField(__field: com.google.protobuf.Descriptors.FieldDescriptor): scala.Any = { 55 | __field.getNumber match { 56 | case 1 => { 57 | val __t = id 58 | if (__t != com.google.protobuf.ByteString.EMPTY) __t else null 59 | } 60 | } 61 | } 62 | override def toString: String = com.trueaccord.scalapb.TextFormat.printToUnicodeString(this) 63 | def companion = com.komanov.serialization.domain.protos.events.PageComponentPositionResetPb 64 | } 65 | 66 | object PageComponentPositionResetPb extends com.trueaccord.scalapb.GeneratedMessageCompanion[PageComponentPositionResetPb] { 67 | implicit def messageCompanion: com.trueaccord.scalapb.GeneratedMessageCompanion[PageComponentPositionResetPb] = this 68 | def fromFieldsMap(__fieldsMap: Map[com.google.protobuf.Descriptors.FieldDescriptor, scala.Any]): com.komanov.serialization.domain.protos.events.PageComponentPositionResetPb = { 69 | require(__fieldsMap.keys.forall(_.getContainingType() == descriptor), "FieldDescriptor does not match message type.") 70 | val __fields = descriptor.getFields 71 | com.komanov.serialization.domain.protos.events.PageComponentPositionResetPb( 72 | __fieldsMap.getOrElse(__fields.get(0), com.google.protobuf.ByteString.EMPTY).asInstanceOf[com.google.protobuf.ByteString] 73 | ) 74 | } 75 | def descriptor: com.google.protobuf.Descriptors.Descriptor = EventsProto.descriptor.getMessageTypes.get(21) 76 | def messageCompanionForField(__field: com.google.protobuf.Descriptors.FieldDescriptor): com.trueaccord.scalapb.GeneratedMessageCompanion[_] = throw new MatchError(__field) 77 | def enumCompanionForField(__field: com.google.protobuf.Descriptors.FieldDescriptor): com.trueaccord.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__field) 78 | lazy val defaultInstance = com.komanov.serialization.domain.protos.events.PageComponentPositionResetPb( 79 | ) 80 | implicit class PageComponentPositionResetPbLens[UpperPB](_l: com.trueaccord.lenses.Lens[UpperPB, PageComponentPositionResetPb]) extends com.trueaccord.lenses.ObjectLens[UpperPB, PageComponentPositionResetPb](_l) { 81 | def id: com.trueaccord.lenses.Lens[UpperPB, com.google.protobuf.ByteString] = field(_.id)((c_, f_) => c_.copy(id = f_)) 82 | } 83 | final val ID_FIELD_NUMBER = 1 84 | } 85 | -------------------------------------------------------------------------------- /scala-serialization/src/main/scala/com/komanov/serialization/domain/protos/events/PageComponentPositionSetPb.scala: -------------------------------------------------------------------------------- 1 | // Generated by the Scala Plugin for the Protocol Buffer Compiler. 2 | // Do not edit! 3 | // 4 | // Protofile syntax: PROTO3 5 | 6 | package com.komanov.serialization.domain.protos.events 7 | 8 | 9 | 10 | @SerialVersionUID(0L) 11 | final case class PageComponentPositionSetPb( 12 | id: com.google.protobuf.ByteString = com.google.protobuf.ByteString.EMPTY, 13 | x: Int = 0, 14 | y: Int = 0 15 | ) extends com.trueaccord.scalapb.GeneratedMessage with com.trueaccord.scalapb.Message[PageComponentPositionSetPb] with com.trueaccord.lenses.Updatable[PageComponentPositionSetPb] { 16 | @transient 17 | private[this] var __serializedSizeCachedValue: Int = 0 18 | private[this] def __computeSerializedValue(): Int = { 19 | var __size = 0 20 | if (id != com.google.protobuf.ByteString.EMPTY) { __size += com.google.protobuf.CodedOutputStream.computeBytesSize(1, id) } 21 | if (x != 0) { __size += com.google.protobuf.CodedOutputStream.computeUInt32Size(2, x) } 22 | if (y != 0) { __size += com.google.protobuf.CodedOutputStream.computeUInt32Size(3, y) } 23 | __size 24 | } 25 | final override def serializedSize: Int = { 26 | var read = __serializedSizeCachedValue 27 | if (read == 0) { 28 | read = __computeSerializedValue() 29 | __serializedSizeCachedValue = read 30 | } 31 | read 32 | } 33 | def writeTo(output: com.google.protobuf.CodedOutputStream): Unit = { 34 | { 35 | val __v = id 36 | if (__v != com.google.protobuf.ByteString.EMPTY) { 37 | output.writeBytes(1, __v) 38 | } 39 | }; 40 | { 41 | val __v = x 42 | if (__v != 0) { 43 | output.writeUInt32(2, __v) 44 | } 45 | }; 46 | { 47 | val __v = y 48 | if (__v != 0) { 49 | output.writeUInt32(3, __v) 50 | } 51 | }; 52 | } 53 | def mergeFrom(__input: com.google.protobuf.CodedInputStream): com.komanov.serialization.domain.protos.events.PageComponentPositionSetPb = { 54 | var __id = this.id 55 | var __x = this.x 56 | var __y = this.y 57 | var _done__ = false 58 | while (!_done__) { 59 | val _tag__ = __input.readTag() 60 | _tag__ match { 61 | case 0 => _done__ = true 62 | case 10 => 63 | __id = __input.readBytes() 64 | case 16 => 65 | __x = __input.readUInt32() 66 | case 24 => 67 | __y = __input.readUInt32() 68 | case tag => __input.skipField(tag) 69 | } 70 | } 71 | com.komanov.serialization.domain.protos.events.PageComponentPositionSetPb( 72 | id = __id, 73 | x = __x, 74 | y = __y 75 | ) 76 | } 77 | def withId(__v: com.google.protobuf.ByteString): PageComponentPositionSetPb = copy(id = __v) 78 | def withX(__v: Int): PageComponentPositionSetPb = copy(x = __v) 79 | def withY(__v: Int): PageComponentPositionSetPb = copy(y = __v) 80 | def getField(__field: com.google.protobuf.Descriptors.FieldDescriptor): scala.Any = { 81 | __field.getNumber match { 82 | case 1 => { 83 | val __t = id 84 | if (__t != com.google.protobuf.ByteString.EMPTY) __t else null 85 | } 86 | case 2 => { 87 | val __t = x 88 | if (__t != 0) __t else null 89 | } 90 | case 3 => { 91 | val __t = y 92 | if (__t != 0) __t else null 93 | } 94 | } 95 | } 96 | override def toString: String = com.trueaccord.scalapb.TextFormat.printToUnicodeString(this) 97 | def companion = com.komanov.serialization.domain.protos.events.PageComponentPositionSetPb 98 | } 99 | 100 | object PageComponentPositionSetPb extends com.trueaccord.scalapb.GeneratedMessageCompanion[PageComponentPositionSetPb] { 101 | implicit def messageCompanion: com.trueaccord.scalapb.GeneratedMessageCompanion[PageComponentPositionSetPb] = this 102 | def fromFieldsMap(__fieldsMap: Map[com.google.protobuf.Descriptors.FieldDescriptor, scala.Any]): com.komanov.serialization.domain.protos.events.PageComponentPositionSetPb = { 103 | require(__fieldsMap.keys.forall(_.getContainingType() == descriptor), "FieldDescriptor does not match message type.") 104 | val __fields = descriptor.getFields 105 | com.komanov.serialization.domain.protos.events.PageComponentPositionSetPb( 106 | __fieldsMap.getOrElse(__fields.get(0), com.google.protobuf.ByteString.EMPTY).asInstanceOf[com.google.protobuf.ByteString], 107 | __fieldsMap.getOrElse(__fields.get(1), 0).asInstanceOf[Int], 108 | __fieldsMap.getOrElse(__fields.get(2), 0).asInstanceOf[Int] 109 | ) 110 | } 111 | def descriptor: com.google.protobuf.Descriptors.Descriptor = EventsProto.descriptor.getMessageTypes.get(20) 112 | def messageCompanionForField(__field: com.google.protobuf.Descriptors.FieldDescriptor): com.trueaccord.scalapb.GeneratedMessageCompanion[_] = throw new MatchError(__field) 113 | def enumCompanionForField(__field: com.google.protobuf.Descriptors.FieldDescriptor): com.trueaccord.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__field) 114 | lazy val defaultInstance = com.komanov.serialization.domain.protos.events.PageComponentPositionSetPb( 115 | ) 116 | implicit class PageComponentPositionSetPbLens[UpperPB](_l: com.trueaccord.lenses.Lens[UpperPB, PageComponentPositionSetPb]) extends com.trueaccord.lenses.ObjectLens[UpperPB, PageComponentPositionSetPb](_l) { 117 | def id: com.trueaccord.lenses.Lens[UpperPB, com.google.protobuf.ByteString] = field(_.id)((c_, f_) => c_.copy(id = f_)) 118 | def x: com.trueaccord.lenses.Lens[UpperPB, Int] = field(_.x)((c_, f_) => c_.copy(x = f_)) 119 | def y: com.trueaccord.lenses.Lens[UpperPB, Int] = field(_.y)((c_, f_) => c_.copy(y = f_)) 120 | } 121 | final val ID_FIELD_NUMBER = 1 122 | final val X_FIELD_NUMBER = 2 123 | final val Y_FIELD_NUMBER = 3 124 | } 125 | -------------------------------------------------------------------------------- /scala-serialization/src/main/scala/com/komanov/serialization/domain/protos/events/PageComponentRemovedPb.scala: -------------------------------------------------------------------------------- 1 | // Generated by the Scala Plugin for the Protocol Buffer Compiler. 2 | // Do not edit! 3 | // 4 | // Protofile syntax: PROTO3 5 | 6 | package com.komanov.serialization.domain.protos.events 7 | 8 | 9 | 10 | @SerialVersionUID(0L) 11 | final case class PageComponentRemovedPb( 12 | pagePath: String = "", 13 | id: com.google.protobuf.ByteString = com.google.protobuf.ByteString.EMPTY 14 | ) extends com.trueaccord.scalapb.GeneratedMessage with com.trueaccord.scalapb.Message[PageComponentRemovedPb] with com.trueaccord.lenses.Updatable[PageComponentRemovedPb] { 15 | @transient 16 | private[this] var __serializedSizeCachedValue: Int = 0 17 | private[this] def __computeSerializedValue(): Int = { 18 | var __size = 0 19 | if (pagePath != "") { __size += com.google.protobuf.CodedOutputStream.computeStringSize(1, pagePath) } 20 | if (id != com.google.protobuf.ByteString.EMPTY) { __size += com.google.protobuf.CodedOutputStream.computeBytesSize(2, id) } 21 | __size 22 | } 23 | final override def serializedSize: Int = { 24 | var read = __serializedSizeCachedValue 25 | if (read == 0) { 26 | read = __computeSerializedValue() 27 | __serializedSizeCachedValue = read 28 | } 29 | read 30 | } 31 | def writeTo(output: com.google.protobuf.CodedOutputStream): Unit = { 32 | { 33 | val __v = pagePath 34 | if (__v != "") { 35 | output.writeString(1, __v) 36 | } 37 | }; 38 | { 39 | val __v = id 40 | if (__v != com.google.protobuf.ByteString.EMPTY) { 41 | output.writeBytes(2, __v) 42 | } 43 | }; 44 | } 45 | def mergeFrom(__input: com.google.protobuf.CodedInputStream): com.komanov.serialization.domain.protos.events.PageComponentRemovedPb = { 46 | var __pagePath = this.pagePath 47 | var __id = this.id 48 | var _done__ = false 49 | while (!_done__) { 50 | val _tag__ = __input.readTag() 51 | _tag__ match { 52 | case 0 => _done__ = true 53 | case 10 => 54 | __pagePath = __input.readString() 55 | case 18 => 56 | __id = __input.readBytes() 57 | case tag => __input.skipField(tag) 58 | } 59 | } 60 | com.komanov.serialization.domain.protos.events.PageComponentRemovedPb( 61 | pagePath = __pagePath, 62 | id = __id 63 | ) 64 | } 65 | def withPagePath(__v: String): PageComponentRemovedPb = copy(pagePath = __v) 66 | def withId(__v: com.google.protobuf.ByteString): PageComponentRemovedPb = copy(id = __v) 67 | def getField(__field: com.google.protobuf.Descriptors.FieldDescriptor): scala.Any = { 68 | __field.getNumber match { 69 | case 1 => { 70 | val __t = pagePath 71 | if (__t != "") __t else null 72 | } 73 | case 2 => { 74 | val __t = id 75 | if (__t != com.google.protobuf.ByteString.EMPTY) __t else null 76 | } 77 | } 78 | } 79 | override def toString: String = com.trueaccord.scalapb.TextFormat.printToUnicodeString(this) 80 | def companion = com.komanov.serialization.domain.protos.events.PageComponentRemovedPb 81 | } 82 | 83 | object PageComponentRemovedPb extends com.trueaccord.scalapb.GeneratedMessageCompanion[PageComponentRemovedPb] { 84 | implicit def messageCompanion: com.trueaccord.scalapb.GeneratedMessageCompanion[PageComponentRemovedPb] = this 85 | def fromFieldsMap(__fieldsMap: Map[com.google.protobuf.Descriptors.FieldDescriptor, scala.Any]): com.komanov.serialization.domain.protos.events.PageComponentRemovedPb = { 86 | require(__fieldsMap.keys.forall(_.getContainingType() == descriptor), "FieldDescriptor does not match message type.") 87 | val __fields = descriptor.getFields 88 | com.komanov.serialization.domain.protos.events.PageComponentRemovedPb( 89 | __fieldsMap.getOrElse(__fields.get(0), "").asInstanceOf[String], 90 | __fieldsMap.getOrElse(__fields.get(1), com.google.protobuf.ByteString.EMPTY).asInstanceOf[com.google.protobuf.ByteString] 91 | ) 92 | } 93 | def descriptor: com.google.protobuf.Descriptors.Descriptor = EventsProto.descriptor.getMessageTypes.get(19) 94 | def messageCompanionForField(__field: com.google.protobuf.Descriptors.FieldDescriptor): com.trueaccord.scalapb.GeneratedMessageCompanion[_] = throw new MatchError(__field) 95 | def enumCompanionForField(__field: com.google.protobuf.Descriptors.FieldDescriptor): com.trueaccord.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__field) 96 | lazy val defaultInstance = com.komanov.serialization.domain.protos.events.PageComponentRemovedPb( 97 | ) 98 | implicit class PageComponentRemovedPbLens[UpperPB](_l: com.trueaccord.lenses.Lens[UpperPB, PageComponentRemovedPb]) extends com.trueaccord.lenses.ObjectLens[UpperPB, PageComponentRemovedPb](_l) { 99 | def pagePath: com.trueaccord.lenses.Lens[UpperPB, String] = field(_.pagePath)((c_, f_) => c_.copy(pagePath = f_)) 100 | def id: com.trueaccord.lenses.Lens[UpperPB, com.google.protobuf.ByteString] = field(_.id)((c_, f_) => c_.copy(id = f_)) 101 | } 102 | final val PAGEPATH_FIELD_NUMBER = 1 103 | final val ID_FIELD_NUMBER = 2 104 | } 105 | -------------------------------------------------------------------------------- /scala-serialization/src/main/scala/com/komanov/serialization/domain/protos/events/PageMetaTagAddedPb.scala: -------------------------------------------------------------------------------- 1 | // Generated by the Scala Plugin for the Protocol Buffer Compiler. 2 | // Do not edit! 3 | // 4 | // Protofile syntax: PROTO3 5 | 6 | package com.komanov.serialization.domain.protos.events 7 | 8 | 9 | 10 | @SerialVersionUID(0L) 11 | final case class PageMetaTagAddedPb( 12 | path: String = "", 13 | name: String = "", 14 | value: String = "" 15 | ) extends com.trueaccord.scalapb.GeneratedMessage with com.trueaccord.scalapb.Message[PageMetaTagAddedPb] with com.trueaccord.lenses.Updatable[PageMetaTagAddedPb] { 16 | @transient 17 | private[this] var __serializedSizeCachedValue: Int = 0 18 | private[this] def __computeSerializedValue(): Int = { 19 | var __size = 0 20 | if (path != "") { __size += com.google.protobuf.CodedOutputStream.computeStringSize(1, path) } 21 | if (name != "") { __size += com.google.protobuf.CodedOutputStream.computeStringSize(2, name) } 22 | if (value != "") { __size += com.google.protobuf.CodedOutputStream.computeStringSize(3, value) } 23 | __size 24 | } 25 | final override def serializedSize: Int = { 26 | var read = __serializedSizeCachedValue 27 | if (read == 0) { 28 | read = __computeSerializedValue() 29 | __serializedSizeCachedValue = read 30 | } 31 | read 32 | } 33 | def writeTo(output: com.google.protobuf.CodedOutputStream): Unit = { 34 | { 35 | val __v = path 36 | if (__v != "") { 37 | output.writeString(1, __v) 38 | } 39 | }; 40 | { 41 | val __v = name 42 | if (__v != "") { 43 | output.writeString(2, __v) 44 | } 45 | }; 46 | { 47 | val __v = value 48 | if (__v != "") { 49 | output.writeString(3, __v) 50 | } 51 | }; 52 | } 53 | def mergeFrom(__input: com.google.protobuf.CodedInputStream): com.komanov.serialization.domain.protos.events.PageMetaTagAddedPb = { 54 | var __path = this.path 55 | var __name = this.name 56 | var __value = this.value 57 | var _done__ = false 58 | while (!_done__) { 59 | val _tag__ = __input.readTag() 60 | _tag__ match { 61 | case 0 => _done__ = true 62 | case 10 => 63 | __path = __input.readString() 64 | case 18 => 65 | __name = __input.readString() 66 | case 26 => 67 | __value = __input.readString() 68 | case tag => __input.skipField(tag) 69 | } 70 | } 71 | com.komanov.serialization.domain.protos.events.PageMetaTagAddedPb( 72 | path = __path, 73 | name = __name, 74 | value = __value 75 | ) 76 | } 77 | def withPath(__v: String): PageMetaTagAddedPb = copy(path = __v) 78 | def withName(__v: String): PageMetaTagAddedPb = copy(name = __v) 79 | def withValue(__v: String): PageMetaTagAddedPb = copy(value = __v) 80 | def getField(__field: com.google.protobuf.Descriptors.FieldDescriptor): scala.Any = { 81 | __field.getNumber match { 82 | case 1 => { 83 | val __t = path 84 | if (__t != "") __t else null 85 | } 86 | case 2 => { 87 | val __t = name 88 | if (__t != "") __t else null 89 | } 90 | case 3 => { 91 | val __t = value 92 | if (__t != "") __t else null 93 | } 94 | } 95 | } 96 | override def toString: String = com.trueaccord.scalapb.TextFormat.printToUnicodeString(this) 97 | def companion = com.komanov.serialization.domain.protos.events.PageMetaTagAddedPb 98 | } 99 | 100 | object PageMetaTagAddedPb extends com.trueaccord.scalapb.GeneratedMessageCompanion[PageMetaTagAddedPb] { 101 | implicit def messageCompanion: com.trueaccord.scalapb.GeneratedMessageCompanion[PageMetaTagAddedPb] = this 102 | def fromFieldsMap(__fieldsMap: Map[com.google.protobuf.Descriptors.FieldDescriptor, scala.Any]): com.komanov.serialization.domain.protos.events.PageMetaTagAddedPb = { 103 | require(__fieldsMap.keys.forall(_.getContainingType() == descriptor), "FieldDescriptor does not match message type.") 104 | val __fields = descriptor.getFields 105 | com.komanov.serialization.domain.protos.events.PageMetaTagAddedPb( 106 | __fieldsMap.getOrElse(__fields.get(0), "").asInstanceOf[String], 107 | __fieldsMap.getOrElse(__fields.get(1), "").asInstanceOf[String], 108 | __fieldsMap.getOrElse(__fields.get(2), "").asInstanceOf[String] 109 | ) 110 | } 111 | def descriptor: com.google.protobuf.Descriptors.Descriptor = EventsProto.descriptor.getMessageTypes.get(16) 112 | def messageCompanionForField(__field: com.google.protobuf.Descriptors.FieldDescriptor): com.trueaccord.scalapb.GeneratedMessageCompanion[_] = throw new MatchError(__field) 113 | def enumCompanionForField(__field: com.google.protobuf.Descriptors.FieldDescriptor): com.trueaccord.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__field) 114 | lazy val defaultInstance = com.komanov.serialization.domain.protos.events.PageMetaTagAddedPb( 115 | ) 116 | implicit class PageMetaTagAddedPbLens[UpperPB](_l: com.trueaccord.lenses.Lens[UpperPB, PageMetaTagAddedPb]) extends com.trueaccord.lenses.ObjectLens[UpperPB, PageMetaTagAddedPb](_l) { 117 | def path: com.trueaccord.lenses.Lens[UpperPB, String] = field(_.path)((c_, f_) => c_.copy(path = f_)) 118 | def name: com.trueaccord.lenses.Lens[UpperPB, String] = field(_.name)((c_, f_) => c_.copy(name = f_)) 119 | def value: com.trueaccord.lenses.Lens[UpperPB, String] = field(_.value)((c_, f_) => c_.copy(value = f_)) 120 | } 121 | final val PATH_FIELD_NUMBER = 1 122 | final val NAME_FIELD_NUMBER = 2 123 | final val VALUE_FIELD_NUMBER = 3 124 | } 125 | -------------------------------------------------------------------------------- /scala-serialization/src/main/scala/com/komanov/serialization/domain/protos/events/PageMetaTagRemovedPb.scala: -------------------------------------------------------------------------------- 1 | // Generated by the Scala Plugin for the Protocol Buffer Compiler. 2 | // Do not edit! 3 | // 4 | // Protofile syntax: PROTO3 5 | 6 | package com.komanov.serialization.domain.protos.events 7 | 8 | 9 | 10 | @SerialVersionUID(0L) 11 | final case class PageMetaTagRemovedPb( 12 | path: String = "", 13 | name: String = "" 14 | ) extends com.trueaccord.scalapb.GeneratedMessage with com.trueaccord.scalapb.Message[PageMetaTagRemovedPb] with com.trueaccord.lenses.Updatable[PageMetaTagRemovedPb] { 15 | @transient 16 | private[this] var __serializedSizeCachedValue: Int = 0 17 | private[this] def __computeSerializedValue(): Int = { 18 | var __size = 0 19 | if (path != "") { __size += com.google.protobuf.CodedOutputStream.computeStringSize(1, path) } 20 | if (name != "") { __size += com.google.protobuf.CodedOutputStream.computeStringSize(2, name) } 21 | __size 22 | } 23 | final override def serializedSize: Int = { 24 | var read = __serializedSizeCachedValue 25 | if (read == 0) { 26 | read = __computeSerializedValue() 27 | __serializedSizeCachedValue = read 28 | } 29 | read 30 | } 31 | def writeTo(output: com.google.protobuf.CodedOutputStream): Unit = { 32 | { 33 | val __v = path 34 | if (__v != "") { 35 | output.writeString(1, __v) 36 | } 37 | }; 38 | { 39 | val __v = name 40 | if (__v != "") { 41 | output.writeString(2, __v) 42 | } 43 | }; 44 | } 45 | def mergeFrom(__input: com.google.protobuf.CodedInputStream): com.komanov.serialization.domain.protos.events.PageMetaTagRemovedPb = { 46 | var __path = this.path 47 | var __name = this.name 48 | var _done__ = false 49 | while (!_done__) { 50 | val _tag__ = __input.readTag() 51 | _tag__ match { 52 | case 0 => _done__ = true 53 | case 10 => 54 | __path = __input.readString() 55 | case 18 => 56 | __name = __input.readString() 57 | case tag => __input.skipField(tag) 58 | } 59 | } 60 | com.komanov.serialization.domain.protos.events.PageMetaTagRemovedPb( 61 | path = __path, 62 | name = __name 63 | ) 64 | } 65 | def withPath(__v: String): PageMetaTagRemovedPb = copy(path = __v) 66 | def withName(__v: String): PageMetaTagRemovedPb = copy(name = __v) 67 | def getField(__field: com.google.protobuf.Descriptors.FieldDescriptor): scala.Any = { 68 | __field.getNumber match { 69 | case 1 => { 70 | val __t = path 71 | if (__t != "") __t else null 72 | } 73 | case 2 => { 74 | val __t = name 75 | if (__t != "") __t else null 76 | } 77 | } 78 | } 79 | override def toString: String = com.trueaccord.scalapb.TextFormat.printToUnicodeString(this) 80 | def companion = com.komanov.serialization.domain.protos.events.PageMetaTagRemovedPb 81 | } 82 | 83 | object PageMetaTagRemovedPb extends com.trueaccord.scalapb.GeneratedMessageCompanion[PageMetaTagRemovedPb] { 84 | implicit def messageCompanion: com.trueaccord.scalapb.GeneratedMessageCompanion[PageMetaTagRemovedPb] = this 85 | def fromFieldsMap(__fieldsMap: Map[com.google.protobuf.Descriptors.FieldDescriptor, scala.Any]): com.komanov.serialization.domain.protos.events.PageMetaTagRemovedPb = { 86 | require(__fieldsMap.keys.forall(_.getContainingType() == descriptor), "FieldDescriptor does not match message type.") 87 | val __fields = descriptor.getFields 88 | com.komanov.serialization.domain.protos.events.PageMetaTagRemovedPb( 89 | __fieldsMap.getOrElse(__fields.get(0), "").asInstanceOf[String], 90 | __fieldsMap.getOrElse(__fields.get(1), "").asInstanceOf[String] 91 | ) 92 | } 93 | def descriptor: com.google.protobuf.Descriptors.Descriptor = EventsProto.descriptor.getMessageTypes.get(17) 94 | def messageCompanionForField(__field: com.google.protobuf.Descriptors.FieldDescriptor): com.trueaccord.scalapb.GeneratedMessageCompanion[_] = throw new MatchError(__field) 95 | def enumCompanionForField(__field: com.google.protobuf.Descriptors.FieldDescriptor): com.trueaccord.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__field) 96 | lazy val defaultInstance = com.komanov.serialization.domain.protos.events.PageMetaTagRemovedPb( 97 | ) 98 | implicit class PageMetaTagRemovedPbLens[UpperPB](_l: com.trueaccord.lenses.Lens[UpperPB, PageMetaTagRemovedPb]) extends com.trueaccord.lenses.ObjectLens[UpperPB, PageMetaTagRemovedPb](_l) { 99 | def path: com.trueaccord.lenses.Lens[UpperPB, String] = field(_.path)((c_, f_) => c_.copy(path = f_)) 100 | def name: com.trueaccord.lenses.Lens[UpperPB, String] = field(_.name)((c_, f_) => c_.copy(name = f_)) 101 | } 102 | final val PATH_FIELD_NUMBER = 1 103 | final val NAME_FIELD_NUMBER = 2 104 | } 105 | -------------------------------------------------------------------------------- /scala-serialization/src/main/scala/com/komanov/serialization/domain/protos/events/PageNameSetPb.scala: -------------------------------------------------------------------------------- 1 | // Generated by the Scala Plugin for the Protocol Buffer Compiler. 2 | // Do not edit! 3 | // 4 | // Protofile syntax: PROTO3 5 | 6 | package com.komanov.serialization.domain.protos.events 7 | 8 | 9 | 10 | @SerialVersionUID(0L) 11 | final case class PageNameSetPb( 12 | path: String = "", 13 | name: String = "" 14 | ) extends com.trueaccord.scalapb.GeneratedMessage with com.trueaccord.scalapb.Message[PageNameSetPb] with com.trueaccord.lenses.Updatable[PageNameSetPb] { 15 | @transient 16 | private[this] var __serializedSizeCachedValue: Int = 0 17 | private[this] def __computeSerializedValue(): Int = { 18 | var __size = 0 19 | if (path != "") { __size += com.google.protobuf.CodedOutputStream.computeStringSize(1, path) } 20 | if (name != "") { __size += com.google.protobuf.CodedOutputStream.computeStringSize(2, name) } 21 | __size 22 | } 23 | final override def serializedSize: Int = { 24 | var read = __serializedSizeCachedValue 25 | if (read == 0) { 26 | read = __computeSerializedValue() 27 | __serializedSizeCachedValue = read 28 | } 29 | read 30 | } 31 | def writeTo(output: com.google.protobuf.CodedOutputStream): Unit = { 32 | { 33 | val __v = path 34 | if (__v != "") { 35 | output.writeString(1, __v) 36 | } 37 | }; 38 | { 39 | val __v = name 40 | if (__v != "") { 41 | output.writeString(2, __v) 42 | } 43 | }; 44 | } 45 | def mergeFrom(__input: com.google.protobuf.CodedInputStream): com.komanov.serialization.domain.protos.events.PageNameSetPb = { 46 | var __path = this.path 47 | var __name = this.name 48 | var _done__ = false 49 | while (!_done__) { 50 | val _tag__ = __input.readTag() 51 | _tag__ match { 52 | case 0 => _done__ = true 53 | case 10 => 54 | __path = __input.readString() 55 | case 18 => 56 | __name = __input.readString() 57 | case tag => __input.skipField(tag) 58 | } 59 | } 60 | com.komanov.serialization.domain.protos.events.PageNameSetPb( 61 | path = __path, 62 | name = __name 63 | ) 64 | } 65 | def withPath(__v: String): PageNameSetPb = copy(path = __v) 66 | def withName(__v: String): PageNameSetPb = copy(name = __v) 67 | def getField(__field: com.google.protobuf.Descriptors.FieldDescriptor): scala.Any = { 68 | __field.getNumber match { 69 | case 1 => { 70 | val __t = path 71 | if (__t != "") __t else null 72 | } 73 | case 2 => { 74 | val __t = name 75 | if (__t != "") __t else null 76 | } 77 | } 78 | } 79 | override def toString: String = com.trueaccord.scalapb.TextFormat.printToUnicodeString(this) 80 | def companion = com.komanov.serialization.domain.protos.events.PageNameSetPb 81 | } 82 | 83 | object PageNameSetPb extends com.trueaccord.scalapb.GeneratedMessageCompanion[PageNameSetPb] { 84 | implicit def messageCompanion: com.trueaccord.scalapb.GeneratedMessageCompanion[PageNameSetPb] = this 85 | def fromFieldsMap(__fieldsMap: Map[com.google.protobuf.Descriptors.FieldDescriptor, scala.Any]): com.komanov.serialization.domain.protos.events.PageNameSetPb = { 86 | require(__fieldsMap.keys.forall(_.getContainingType() == descriptor), "FieldDescriptor does not match message type.") 87 | val __fields = descriptor.getFields 88 | com.komanov.serialization.domain.protos.events.PageNameSetPb( 89 | __fieldsMap.getOrElse(__fields.get(0), "").asInstanceOf[String], 90 | __fieldsMap.getOrElse(__fields.get(1), "").asInstanceOf[String] 91 | ) 92 | } 93 | def descriptor: com.google.protobuf.Descriptors.Descriptor = EventsProto.descriptor.getMessageTypes.get(15) 94 | def messageCompanionForField(__field: com.google.protobuf.Descriptors.FieldDescriptor): com.trueaccord.scalapb.GeneratedMessageCompanion[_] = throw new MatchError(__field) 95 | def enumCompanionForField(__field: com.google.protobuf.Descriptors.FieldDescriptor): com.trueaccord.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__field) 96 | lazy val defaultInstance = com.komanov.serialization.domain.protos.events.PageNameSetPb( 97 | ) 98 | implicit class PageNameSetPbLens[UpperPB](_l: com.trueaccord.lenses.Lens[UpperPB, PageNameSetPb]) extends com.trueaccord.lenses.ObjectLens[UpperPB, PageNameSetPb](_l) { 99 | def path: com.trueaccord.lenses.Lens[UpperPB, String] = field(_.path)((c_, f_) => c_.copy(path = f_)) 100 | def name: com.trueaccord.lenses.Lens[UpperPB, String] = field(_.name)((c_, f_) => c_.copy(name = f_)) 101 | } 102 | final val PATH_FIELD_NUMBER = 1 103 | final val NAME_FIELD_NUMBER = 2 104 | } 105 | -------------------------------------------------------------------------------- /scala-serialization/src/main/scala/com/komanov/serialization/domain/protos/events/PageRemovedPb.scala: -------------------------------------------------------------------------------- 1 | // Generated by the Scala Plugin for the Protocol Buffer Compiler. 2 | // Do not edit! 3 | // 4 | // Protofile syntax: PROTO3 5 | 6 | package com.komanov.serialization.domain.protos.events 7 | 8 | 9 | 10 | @SerialVersionUID(0L) 11 | final case class PageRemovedPb( 12 | path: String = "" 13 | ) extends com.trueaccord.scalapb.GeneratedMessage with com.trueaccord.scalapb.Message[PageRemovedPb] with com.trueaccord.lenses.Updatable[PageRemovedPb] { 14 | @transient 15 | private[this] var __serializedSizeCachedValue: Int = 0 16 | private[this] def __computeSerializedValue(): Int = { 17 | var __size = 0 18 | if (path != "") { __size += com.google.protobuf.CodedOutputStream.computeStringSize(1, path) } 19 | __size 20 | } 21 | final override def serializedSize: Int = { 22 | var read = __serializedSizeCachedValue 23 | if (read == 0) { 24 | read = __computeSerializedValue() 25 | __serializedSizeCachedValue = read 26 | } 27 | read 28 | } 29 | def writeTo(output: com.google.protobuf.CodedOutputStream): Unit = { 30 | { 31 | val __v = path 32 | if (__v != "") { 33 | output.writeString(1, __v) 34 | } 35 | }; 36 | } 37 | def mergeFrom(__input: com.google.protobuf.CodedInputStream): com.komanov.serialization.domain.protos.events.PageRemovedPb = { 38 | var __path = this.path 39 | var _done__ = false 40 | while (!_done__) { 41 | val _tag__ = __input.readTag() 42 | _tag__ match { 43 | case 0 => _done__ = true 44 | case 10 => 45 | __path = __input.readString() 46 | case tag => __input.skipField(tag) 47 | } 48 | } 49 | com.komanov.serialization.domain.protos.events.PageRemovedPb( 50 | path = __path 51 | ) 52 | } 53 | def withPath(__v: String): PageRemovedPb = copy(path = __v) 54 | def getField(__field: com.google.protobuf.Descriptors.FieldDescriptor): scala.Any = { 55 | __field.getNumber match { 56 | case 1 => { 57 | val __t = path 58 | if (__t != "") __t else null 59 | } 60 | } 61 | } 62 | override def toString: String = com.trueaccord.scalapb.TextFormat.printToUnicodeString(this) 63 | def companion = com.komanov.serialization.domain.protos.events.PageRemovedPb 64 | } 65 | 66 | object PageRemovedPb extends com.trueaccord.scalapb.GeneratedMessageCompanion[PageRemovedPb] { 67 | implicit def messageCompanion: com.trueaccord.scalapb.GeneratedMessageCompanion[PageRemovedPb] = this 68 | def fromFieldsMap(__fieldsMap: Map[com.google.protobuf.Descriptors.FieldDescriptor, scala.Any]): com.komanov.serialization.domain.protos.events.PageRemovedPb = { 69 | require(__fieldsMap.keys.forall(_.getContainingType() == descriptor), "FieldDescriptor does not match message type.") 70 | val __fields = descriptor.getFields 71 | com.komanov.serialization.domain.protos.events.PageRemovedPb( 72 | __fieldsMap.getOrElse(__fields.get(0), "").asInstanceOf[String] 73 | ) 74 | } 75 | def descriptor: com.google.protobuf.Descriptors.Descriptor = EventsProto.descriptor.getMessageTypes.get(14) 76 | def messageCompanionForField(__field: com.google.protobuf.Descriptors.FieldDescriptor): com.trueaccord.scalapb.GeneratedMessageCompanion[_] = throw new MatchError(__field) 77 | def enumCompanionForField(__field: com.google.protobuf.Descriptors.FieldDescriptor): com.trueaccord.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__field) 78 | lazy val defaultInstance = com.komanov.serialization.domain.protos.events.PageRemovedPb( 79 | ) 80 | implicit class PageRemovedPbLens[UpperPB](_l: com.trueaccord.lenses.Lens[UpperPB, PageRemovedPb]) extends com.trueaccord.lenses.ObjectLens[UpperPB, PageRemovedPb](_l) { 81 | def path: com.trueaccord.lenses.Lens[UpperPB, String] = field(_.path)((c_, f_) => c_.copy(path = f_)) 82 | } 83 | final val PATH_FIELD_NUMBER = 1 84 | } 85 | -------------------------------------------------------------------------------- /scala-serialization/src/main/scala/com/komanov/serialization/domain/protos/events/PrimaryDomainSetPb.scala: -------------------------------------------------------------------------------- 1 | // Generated by the Scala Plugin for the Protocol Buffer Compiler. 2 | // Do not edit! 3 | // 4 | // Protofile syntax: PROTO3 5 | 6 | package com.komanov.serialization.domain.protos.events 7 | 8 | 9 | 10 | @SerialVersionUID(0L) 11 | final case class PrimaryDomainSetPb( 12 | name: String = "" 13 | ) extends com.trueaccord.scalapb.GeneratedMessage with com.trueaccord.scalapb.Message[PrimaryDomainSetPb] with com.trueaccord.lenses.Updatable[PrimaryDomainSetPb] { 14 | @transient 15 | private[this] var __serializedSizeCachedValue: Int = 0 16 | private[this] def __computeSerializedValue(): Int = { 17 | var __size = 0 18 | if (name != "") { __size += com.google.protobuf.CodedOutputStream.computeStringSize(1, name) } 19 | __size 20 | } 21 | final override def serializedSize: Int = { 22 | var read = __serializedSizeCachedValue 23 | if (read == 0) { 24 | read = __computeSerializedValue() 25 | __serializedSizeCachedValue = read 26 | } 27 | read 28 | } 29 | def writeTo(output: com.google.protobuf.CodedOutputStream): Unit = { 30 | { 31 | val __v = name 32 | if (__v != "") { 33 | output.writeString(1, __v) 34 | } 35 | }; 36 | } 37 | def mergeFrom(__input: com.google.protobuf.CodedInputStream): com.komanov.serialization.domain.protos.events.PrimaryDomainSetPb = { 38 | var __name = this.name 39 | var _done__ = false 40 | while (!_done__) { 41 | val _tag__ = __input.readTag() 42 | _tag__ match { 43 | case 0 => _done__ = true 44 | case 10 => 45 | __name = __input.readString() 46 | case tag => __input.skipField(tag) 47 | } 48 | } 49 | com.komanov.serialization.domain.protos.events.PrimaryDomainSetPb( 50 | name = __name 51 | ) 52 | } 53 | def withName(__v: String): PrimaryDomainSetPb = copy(name = __v) 54 | def getField(__field: com.google.protobuf.Descriptors.FieldDescriptor): scala.Any = { 55 | __field.getNumber match { 56 | case 1 => { 57 | val __t = name 58 | if (__t != "") __t else null 59 | } 60 | } 61 | } 62 | override def toString: String = com.trueaccord.scalapb.TextFormat.printToUnicodeString(this) 63 | def companion = com.komanov.serialization.domain.protos.events.PrimaryDomainSetPb 64 | } 65 | 66 | object PrimaryDomainSetPb extends com.trueaccord.scalapb.GeneratedMessageCompanion[PrimaryDomainSetPb] { 67 | implicit def messageCompanion: com.trueaccord.scalapb.GeneratedMessageCompanion[PrimaryDomainSetPb] = this 68 | def fromFieldsMap(__fieldsMap: Map[com.google.protobuf.Descriptors.FieldDescriptor, scala.Any]): com.komanov.serialization.domain.protos.events.PrimaryDomainSetPb = { 69 | require(__fieldsMap.keys.forall(_.getContainingType() == descriptor), "FieldDescriptor does not match message type.") 70 | val __fields = descriptor.getFields 71 | com.komanov.serialization.domain.protos.events.PrimaryDomainSetPb( 72 | __fieldsMap.getOrElse(__fields.get(0), "").asInstanceOf[String] 73 | ) 74 | } 75 | def descriptor: com.google.protobuf.Descriptors.Descriptor = EventsProto.descriptor.getMessageTypes.get(10) 76 | def messageCompanionForField(__field: com.google.protobuf.Descriptors.FieldDescriptor): com.trueaccord.scalapb.GeneratedMessageCompanion[_] = throw new MatchError(__field) 77 | def enumCompanionForField(__field: com.google.protobuf.Descriptors.FieldDescriptor): com.trueaccord.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__field) 78 | lazy val defaultInstance = com.komanov.serialization.domain.protos.events.PrimaryDomainSetPb( 79 | ) 80 | implicit class PrimaryDomainSetPbLens[UpperPB](_l: com.trueaccord.lenses.Lens[UpperPB, PrimaryDomainSetPb]) extends com.trueaccord.lenses.ObjectLens[UpperPB, PrimaryDomainSetPb](_l) { 81 | def name: com.trueaccord.lenses.Lens[UpperPB, String] = field(_.name)((c_, f_) => c_.copy(name = f_)) 82 | } 83 | final val NAME_FIELD_NUMBER = 1 84 | } 85 | -------------------------------------------------------------------------------- /scala-serialization/src/main/scala/com/komanov/serialization/domain/protos/events/PrimaryEntryPointSetPb.scala: -------------------------------------------------------------------------------- 1 | // Generated by the Scala Plugin for the Protocol Buffer Compiler. 2 | // Do not edit! 3 | // 4 | // Protofile syntax: PROTO3 5 | 6 | package com.komanov.serialization.domain.protos.events 7 | 8 | 9 | 10 | @SerialVersionUID(0L) 11 | final case class PrimaryEntryPointSetPb( 12 | lookupKey: String = "" 13 | ) extends com.trueaccord.scalapb.GeneratedMessage with com.trueaccord.scalapb.Message[PrimaryEntryPointSetPb] with com.trueaccord.lenses.Updatable[PrimaryEntryPointSetPb] { 14 | @transient 15 | private[this] var __serializedSizeCachedValue: Int = 0 16 | private[this] def __computeSerializedValue(): Int = { 17 | var __size = 0 18 | if (lookupKey != "") { __size += com.google.protobuf.CodedOutputStream.computeStringSize(1, lookupKey) } 19 | __size 20 | } 21 | final override def serializedSize: Int = { 22 | var read = __serializedSizeCachedValue 23 | if (read == 0) { 24 | read = __computeSerializedValue() 25 | __serializedSizeCachedValue = read 26 | } 27 | read 28 | } 29 | def writeTo(output: com.google.protobuf.CodedOutputStream): Unit = { 30 | { 31 | val __v = lookupKey 32 | if (__v != "") { 33 | output.writeString(1, __v) 34 | } 35 | }; 36 | } 37 | def mergeFrom(__input: com.google.protobuf.CodedInputStream): com.komanov.serialization.domain.protos.events.PrimaryEntryPointSetPb = { 38 | var __lookupKey = this.lookupKey 39 | var _done__ = false 40 | while (!_done__) { 41 | val _tag__ = __input.readTag() 42 | _tag__ match { 43 | case 0 => _done__ = true 44 | case 10 => 45 | __lookupKey = __input.readString() 46 | case tag => __input.skipField(tag) 47 | } 48 | } 49 | com.komanov.serialization.domain.protos.events.PrimaryEntryPointSetPb( 50 | lookupKey = __lookupKey 51 | ) 52 | } 53 | def withLookupKey(__v: String): PrimaryEntryPointSetPb = copy(lookupKey = __v) 54 | def getField(__field: com.google.protobuf.Descriptors.FieldDescriptor): scala.Any = { 55 | __field.getNumber match { 56 | case 1 => { 57 | val __t = lookupKey 58 | if (__t != "") __t else null 59 | } 60 | } 61 | } 62 | override def toString: String = com.trueaccord.scalapb.TextFormat.printToUnicodeString(this) 63 | def companion = com.komanov.serialization.domain.protos.events.PrimaryEntryPointSetPb 64 | } 65 | 66 | object PrimaryEntryPointSetPb extends com.trueaccord.scalapb.GeneratedMessageCompanion[PrimaryEntryPointSetPb] { 67 | implicit def messageCompanion: com.trueaccord.scalapb.GeneratedMessageCompanion[PrimaryEntryPointSetPb] = this 68 | def fromFieldsMap(__fieldsMap: Map[com.google.protobuf.Descriptors.FieldDescriptor, scala.Any]): com.komanov.serialization.domain.protos.events.PrimaryEntryPointSetPb = { 69 | require(__fieldsMap.keys.forall(_.getContainingType() == descriptor), "FieldDescriptor does not match message type.") 70 | val __fields = descriptor.getFields 71 | com.komanov.serialization.domain.protos.events.PrimaryEntryPointSetPb( 72 | __fieldsMap.getOrElse(__fields.get(0), "").asInstanceOf[String] 73 | ) 74 | } 75 | def descriptor: com.google.protobuf.Descriptors.Descriptor = EventsProto.descriptor.getMessageTypes.get(28) 76 | def messageCompanionForField(__field: com.google.protobuf.Descriptors.FieldDescriptor): com.trueaccord.scalapb.GeneratedMessageCompanion[_] = throw new MatchError(__field) 77 | def enumCompanionForField(__field: com.google.protobuf.Descriptors.FieldDescriptor): com.trueaccord.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__field) 78 | lazy val defaultInstance = com.komanov.serialization.domain.protos.events.PrimaryEntryPointSetPb( 79 | ) 80 | implicit class PrimaryEntryPointSetPbLens[UpperPB](_l: com.trueaccord.lenses.Lens[UpperPB, PrimaryEntryPointSetPb]) extends com.trueaccord.lenses.ObjectLens[UpperPB, PrimaryEntryPointSetPb](_l) { 81 | def lookupKey: com.trueaccord.lenses.Lens[UpperPB, String] = field(_.lookupKey)((c_, f_) => c_.copy(lookupKey = f_)) 82 | } 83 | final val LOOKUPKEY_FIELD_NUMBER = 1 84 | } 85 | -------------------------------------------------------------------------------- /scala-serialization/src/main/scala/com/komanov/serialization/domain/protos/events/SiteDescriptionSetPb.scala: -------------------------------------------------------------------------------- 1 | // Generated by the Scala Plugin for the Protocol Buffer Compiler. 2 | // Do not edit! 3 | // 4 | // Protofile syntax: PROTO3 5 | 6 | package com.komanov.serialization.domain.protos.events 7 | 8 | 9 | 10 | @SerialVersionUID(0L) 11 | final case class SiteDescriptionSetPb( 12 | description: String = "" 13 | ) extends com.trueaccord.scalapb.GeneratedMessage with com.trueaccord.scalapb.Message[SiteDescriptionSetPb] with com.trueaccord.lenses.Updatable[SiteDescriptionSetPb] { 14 | @transient 15 | private[this] var __serializedSizeCachedValue: Int = 0 16 | private[this] def __computeSerializedValue(): Int = { 17 | var __size = 0 18 | if (description != "") { __size += com.google.protobuf.CodedOutputStream.computeStringSize(1, description) } 19 | __size 20 | } 21 | final override def serializedSize: Int = { 22 | var read = __serializedSizeCachedValue 23 | if (read == 0) { 24 | read = __computeSerializedValue() 25 | __serializedSizeCachedValue = read 26 | } 27 | read 28 | } 29 | def writeTo(output: com.google.protobuf.CodedOutputStream): Unit = { 30 | { 31 | val __v = description 32 | if (__v != "") { 33 | output.writeString(1, __v) 34 | } 35 | }; 36 | } 37 | def mergeFrom(__input: com.google.protobuf.CodedInputStream): com.komanov.serialization.domain.protos.events.SiteDescriptionSetPb = { 38 | var __description = this.description 39 | var _done__ = false 40 | while (!_done__) { 41 | val _tag__ = __input.readTag() 42 | _tag__ match { 43 | case 0 => _done__ = true 44 | case 10 => 45 | __description = __input.readString() 46 | case tag => __input.skipField(tag) 47 | } 48 | } 49 | com.komanov.serialization.domain.protos.events.SiteDescriptionSetPb( 50 | description = __description 51 | ) 52 | } 53 | def withDescription(__v: String): SiteDescriptionSetPb = copy(description = __v) 54 | def getField(__field: com.google.protobuf.Descriptors.FieldDescriptor): scala.Any = { 55 | __field.getNumber match { 56 | case 1 => { 57 | val __t = description 58 | if (__t != "") __t else null 59 | } 60 | } 61 | } 62 | override def toString: String = com.trueaccord.scalapb.TextFormat.printToUnicodeString(this) 63 | def companion = com.komanov.serialization.domain.protos.events.SiteDescriptionSetPb 64 | } 65 | 66 | object SiteDescriptionSetPb extends com.trueaccord.scalapb.GeneratedMessageCompanion[SiteDescriptionSetPb] { 67 | implicit def messageCompanion: com.trueaccord.scalapb.GeneratedMessageCompanion[SiteDescriptionSetPb] = this 68 | def fromFieldsMap(__fieldsMap: Map[com.google.protobuf.Descriptors.FieldDescriptor, scala.Any]): com.komanov.serialization.domain.protos.events.SiteDescriptionSetPb = { 69 | require(__fieldsMap.keys.forall(_.getContainingType() == descriptor), "FieldDescriptor does not match message type.") 70 | val __fields = descriptor.getFields 71 | com.komanov.serialization.domain.protos.events.SiteDescriptionSetPb( 72 | __fieldsMap.getOrElse(__fields.get(0), "").asInstanceOf[String] 73 | ) 74 | } 75 | def descriptor: com.google.protobuf.Descriptors.Descriptor = EventsProto.descriptor.getMessageTypes.get(2) 76 | def messageCompanionForField(__field: com.google.protobuf.Descriptors.FieldDescriptor): com.trueaccord.scalapb.GeneratedMessageCompanion[_] = throw new MatchError(__field) 77 | def enumCompanionForField(__field: com.google.protobuf.Descriptors.FieldDescriptor): com.trueaccord.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__field) 78 | lazy val defaultInstance = com.komanov.serialization.domain.protos.events.SiteDescriptionSetPb( 79 | ) 80 | implicit class SiteDescriptionSetPbLens[UpperPB](_l: com.trueaccord.lenses.Lens[UpperPB, SiteDescriptionSetPb]) extends com.trueaccord.lenses.ObjectLens[UpperPB, SiteDescriptionSetPb](_l) { 81 | def description: com.trueaccord.lenses.Lens[UpperPB, String] = field(_.description)((c_, f_) => c_.copy(description = f_)) 82 | } 83 | final val DESCRIPTION_FIELD_NUMBER = 1 84 | } 85 | -------------------------------------------------------------------------------- /scala-serialization/src/main/scala/com/komanov/serialization/domain/protos/events/SiteFlagAddedPb.scala: -------------------------------------------------------------------------------- 1 | // Generated by the Scala Plugin for the Protocol Buffer Compiler. 2 | // Do not edit! 3 | // 4 | // Protofile syntax: PROTO3 5 | 6 | package com.komanov.serialization.domain.protos.events 7 | 8 | 9 | 10 | @SerialVersionUID(0L) 11 | final case class SiteFlagAddedPb( 12 | siteFlag: com.komanov.serialization.domain.protos.site.SiteFlagPb = com.komanov.serialization.domain.protos.site.SiteFlagPb.UnknownSiteFlag 13 | ) extends com.trueaccord.scalapb.GeneratedMessage with com.trueaccord.scalapb.Message[SiteFlagAddedPb] with com.trueaccord.lenses.Updatable[SiteFlagAddedPb] { 14 | @transient 15 | private[this] var __serializedSizeCachedValue: Int = 0 16 | private[this] def __computeSerializedValue(): Int = { 17 | var __size = 0 18 | if (siteFlag != com.komanov.serialization.domain.protos.site.SiteFlagPb.UnknownSiteFlag) { __size += com.google.protobuf.CodedOutputStream.computeEnumSize(1, siteFlag.value) } 19 | __size 20 | } 21 | final override def serializedSize: Int = { 22 | var read = __serializedSizeCachedValue 23 | if (read == 0) { 24 | read = __computeSerializedValue() 25 | __serializedSizeCachedValue = read 26 | } 27 | read 28 | } 29 | def writeTo(output: com.google.protobuf.CodedOutputStream): Unit = { 30 | { 31 | val __v = siteFlag 32 | if (__v != com.komanov.serialization.domain.protos.site.SiteFlagPb.UnknownSiteFlag) { 33 | output.writeEnum(1, __v.value) 34 | } 35 | }; 36 | } 37 | def mergeFrom(__input: com.google.protobuf.CodedInputStream): com.komanov.serialization.domain.protos.events.SiteFlagAddedPb = { 38 | var __siteFlag = this.siteFlag 39 | var _done__ = false 40 | while (!_done__) { 41 | val _tag__ = __input.readTag() 42 | _tag__ match { 43 | case 0 => _done__ = true 44 | case 8 => 45 | __siteFlag = com.komanov.serialization.domain.protos.site.SiteFlagPb.fromValue(__input.readEnum()) 46 | case tag => __input.skipField(tag) 47 | } 48 | } 49 | com.komanov.serialization.domain.protos.events.SiteFlagAddedPb( 50 | siteFlag = __siteFlag 51 | ) 52 | } 53 | def withSiteFlag(__v: com.komanov.serialization.domain.protos.site.SiteFlagPb): SiteFlagAddedPb = copy(siteFlag = __v) 54 | def getField(__field: com.google.protobuf.Descriptors.FieldDescriptor): scala.Any = { 55 | __field.getNumber match { 56 | case 1 => { 57 | val __t = siteFlag.valueDescriptor 58 | if (__t.getNumber() != 0) __t else null 59 | } 60 | } 61 | } 62 | override def toString: String = com.trueaccord.scalapb.TextFormat.printToUnicodeString(this) 63 | def companion = com.komanov.serialization.domain.protos.events.SiteFlagAddedPb 64 | } 65 | 66 | object SiteFlagAddedPb extends com.trueaccord.scalapb.GeneratedMessageCompanion[SiteFlagAddedPb] { 67 | implicit def messageCompanion: com.trueaccord.scalapb.GeneratedMessageCompanion[SiteFlagAddedPb] = this 68 | def fromFieldsMap(__fieldsMap: Map[com.google.protobuf.Descriptors.FieldDescriptor, scala.Any]): com.komanov.serialization.domain.protos.events.SiteFlagAddedPb = { 69 | require(__fieldsMap.keys.forall(_.getContainingType() == descriptor), "FieldDescriptor does not match message type.") 70 | val __fields = descriptor.getFields 71 | com.komanov.serialization.domain.protos.events.SiteFlagAddedPb( 72 | com.komanov.serialization.domain.protos.site.SiteFlagPb.fromValue(__fieldsMap.getOrElse(__fields.get(0), com.komanov.serialization.domain.protos.site.SiteFlagPb.UnknownSiteFlag.valueDescriptor).asInstanceOf[com.google.protobuf.Descriptors.EnumValueDescriptor].getNumber) 73 | ) 74 | } 75 | def descriptor: com.google.protobuf.Descriptors.Descriptor = EventsProto.descriptor.getMessageTypes.get(6) 76 | def messageCompanionForField(__field: com.google.protobuf.Descriptors.FieldDescriptor): com.trueaccord.scalapb.GeneratedMessageCompanion[_] = throw new MatchError(__field) 77 | def enumCompanionForField(__field: com.google.protobuf.Descriptors.FieldDescriptor): com.trueaccord.scalapb.GeneratedEnumCompanion[_] = { 78 | require(__field.getContainingType() == descriptor, "FieldDescriptor does not match message type.") 79 | __field.getNumber match { 80 | case 1 => com.komanov.serialization.domain.protos.site.SiteFlagPb 81 | } 82 | } 83 | lazy val defaultInstance = com.komanov.serialization.domain.protos.events.SiteFlagAddedPb( 84 | ) 85 | implicit class SiteFlagAddedPbLens[UpperPB](_l: com.trueaccord.lenses.Lens[UpperPB, SiteFlagAddedPb]) extends com.trueaccord.lenses.ObjectLens[UpperPB, SiteFlagAddedPb](_l) { 86 | def siteFlag: com.trueaccord.lenses.Lens[UpperPB, com.komanov.serialization.domain.protos.site.SiteFlagPb] = field(_.siteFlag)((c_, f_) => c_.copy(siteFlag = f_)) 87 | } 88 | final val SITEFLAG_FIELD_NUMBER = 1 89 | } 90 | -------------------------------------------------------------------------------- /scala-serialization/src/main/scala/com/komanov/serialization/domain/protos/events/SiteFlagRemovedPb.scala: -------------------------------------------------------------------------------- 1 | // Generated by the Scala Plugin for the Protocol Buffer Compiler. 2 | // Do not edit! 3 | // 4 | // Protofile syntax: PROTO3 5 | 6 | package com.komanov.serialization.domain.protos.events 7 | 8 | 9 | 10 | @SerialVersionUID(0L) 11 | final case class SiteFlagRemovedPb( 12 | siteFlag: com.komanov.serialization.domain.protos.site.SiteFlagPb = com.komanov.serialization.domain.protos.site.SiteFlagPb.UnknownSiteFlag 13 | ) extends com.trueaccord.scalapb.GeneratedMessage with com.trueaccord.scalapb.Message[SiteFlagRemovedPb] with com.trueaccord.lenses.Updatable[SiteFlagRemovedPb] { 14 | @transient 15 | private[this] var __serializedSizeCachedValue: Int = 0 16 | private[this] def __computeSerializedValue(): Int = { 17 | var __size = 0 18 | if (siteFlag != com.komanov.serialization.domain.protos.site.SiteFlagPb.UnknownSiteFlag) { __size += com.google.protobuf.CodedOutputStream.computeEnumSize(1, siteFlag.value) } 19 | __size 20 | } 21 | final override def serializedSize: Int = { 22 | var read = __serializedSizeCachedValue 23 | if (read == 0) { 24 | read = __computeSerializedValue() 25 | __serializedSizeCachedValue = read 26 | } 27 | read 28 | } 29 | def writeTo(output: com.google.protobuf.CodedOutputStream): Unit = { 30 | { 31 | val __v = siteFlag 32 | if (__v != com.komanov.serialization.domain.protos.site.SiteFlagPb.UnknownSiteFlag) { 33 | output.writeEnum(1, __v.value) 34 | } 35 | }; 36 | } 37 | def mergeFrom(__input: com.google.protobuf.CodedInputStream): com.komanov.serialization.domain.protos.events.SiteFlagRemovedPb = { 38 | var __siteFlag = this.siteFlag 39 | var _done__ = false 40 | while (!_done__) { 41 | val _tag__ = __input.readTag() 42 | _tag__ match { 43 | case 0 => _done__ = true 44 | case 8 => 45 | __siteFlag = com.komanov.serialization.domain.protos.site.SiteFlagPb.fromValue(__input.readEnum()) 46 | case tag => __input.skipField(tag) 47 | } 48 | } 49 | com.komanov.serialization.domain.protos.events.SiteFlagRemovedPb( 50 | siteFlag = __siteFlag 51 | ) 52 | } 53 | def withSiteFlag(__v: com.komanov.serialization.domain.protos.site.SiteFlagPb): SiteFlagRemovedPb = copy(siteFlag = __v) 54 | def getField(__field: com.google.protobuf.Descriptors.FieldDescriptor): scala.Any = { 55 | __field.getNumber match { 56 | case 1 => { 57 | val __t = siteFlag.valueDescriptor 58 | if (__t.getNumber() != 0) __t else null 59 | } 60 | } 61 | } 62 | override def toString: String = com.trueaccord.scalapb.TextFormat.printToUnicodeString(this) 63 | def companion = com.komanov.serialization.domain.protos.events.SiteFlagRemovedPb 64 | } 65 | 66 | object SiteFlagRemovedPb extends com.trueaccord.scalapb.GeneratedMessageCompanion[SiteFlagRemovedPb] { 67 | implicit def messageCompanion: com.trueaccord.scalapb.GeneratedMessageCompanion[SiteFlagRemovedPb] = this 68 | def fromFieldsMap(__fieldsMap: Map[com.google.protobuf.Descriptors.FieldDescriptor, scala.Any]): com.komanov.serialization.domain.protos.events.SiteFlagRemovedPb = { 69 | require(__fieldsMap.keys.forall(_.getContainingType() == descriptor), "FieldDescriptor does not match message type.") 70 | val __fields = descriptor.getFields 71 | com.komanov.serialization.domain.protos.events.SiteFlagRemovedPb( 72 | com.komanov.serialization.domain.protos.site.SiteFlagPb.fromValue(__fieldsMap.getOrElse(__fields.get(0), com.komanov.serialization.domain.protos.site.SiteFlagPb.UnknownSiteFlag.valueDescriptor).asInstanceOf[com.google.protobuf.Descriptors.EnumValueDescriptor].getNumber) 73 | ) 74 | } 75 | def descriptor: com.google.protobuf.Descriptors.Descriptor = EventsProto.descriptor.getMessageTypes.get(7) 76 | def messageCompanionForField(__field: com.google.protobuf.Descriptors.FieldDescriptor): com.trueaccord.scalapb.GeneratedMessageCompanion[_] = throw new MatchError(__field) 77 | def enumCompanionForField(__field: com.google.protobuf.Descriptors.FieldDescriptor): com.trueaccord.scalapb.GeneratedEnumCompanion[_] = { 78 | require(__field.getContainingType() == descriptor, "FieldDescriptor does not match message type.") 79 | __field.getNumber match { 80 | case 1 => com.komanov.serialization.domain.protos.site.SiteFlagPb 81 | } 82 | } 83 | lazy val defaultInstance = com.komanov.serialization.domain.protos.events.SiteFlagRemovedPb( 84 | ) 85 | implicit class SiteFlagRemovedPbLens[UpperPB](_l: com.trueaccord.lenses.Lens[UpperPB, SiteFlagRemovedPb]) extends com.trueaccord.lenses.ObjectLens[UpperPB, SiteFlagRemovedPb](_l) { 86 | def siteFlag: com.trueaccord.lenses.Lens[UpperPB, com.komanov.serialization.domain.protos.site.SiteFlagPb] = field(_.siteFlag)((c_, f_) => c_.copy(siteFlag = f_)) 87 | } 88 | final val SITEFLAG_FIELD_NUMBER = 1 89 | } 90 | -------------------------------------------------------------------------------- /scala-serialization/src/main/scala/com/komanov/serialization/domain/protos/events/SiteNameSetPb.scala: -------------------------------------------------------------------------------- 1 | // Generated by the Scala Plugin for the Protocol Buffer Compiler. 2 | // Do not edit! 3 | // 4 | // Protofile syntax: PROTO3 5 | 6 | package com.komanov.serialization.domain.protos.events 7 | 8 | 9 | 10 | @SerialVersionUID(0L) 11 | final case class SiteNameSetPb( 12 | name: String = "" 13 | ) extends com.trueaccord.scalapb.GeneratedMessage with com.trueaccord.scalapb.Message[SiteNameSetPb] with com.trueaccord.lenses.Updatable[SiteNameSetPb] { 14 | @transient 15 | private[this] var __serializedSizeCachedValue: Int = 0 16 | private[this] def __computeSerializedValue(): Int = { 17 | var __size = 0 18 | if (name != "") { __size += com.google.protobuf.CodedOutputStream.computeStringSize(1, name) } 19 | __size 20 | } 21 | final override def serializedSize: Int = { 22 | var read = __serializedSizeCachedValue 23 | if (read == 0) { 24 | read = __computeSerializedValue() 25 | __serializedSizeCachedValue = read 26 | } 27 | read 28 | } 29 | def writeTo(output: com.google.protobuf.CodedOutputStream): Unit = { 30 | { 31 | val __v = name 32 | if (__v != "") { 33 | output.writeString(1, __v) 34 | } 35 | }; 36 | } 37 | def mergeFrom(__input: com.google.protobuf.CodedInputStream): com.komanov.serialization.domain.protos.events.SiteNameSetPb = { 38 | var __name = this.name 39 | var _done__ = false 40 | while (!_done__) { 41 | val _tag__ = __input.readTag() 42 | _tag__ match { 43 | case 0 => _done__ = true 44 | case 10 => 45 | __name = __input.readString() 46 | case tag => __input.skipField(tag) 47 | } 48 | } 49 | com.komanov.serialization.domain.protos.events.SiteNameSetPb( 50 | name = __name 51 | ) 52 | } 53 | def withName(__v: String): SiteNameSetPb = copy(name = __v) 54 | def getField(__field: com.google.protobuf.Descriptors.FieldDescriptor): scala.Any = { 55 | __field.getNumber match { 56 | case 1 => { 57 | val __t = name 58 | if (__t != "") __t else null 59 | } 60 | } 61 | } 62 | override def toString: String = com.trueaccord.scalapb.TextFormat.printToUnicodeString(this) 63 | def companion = com.komanov.serialization.domain.protos.events.SiteNameSetPb 64 | } 65 | 66 | object SiteNameSetPb extends com.trueaccord.scalapb.GeneratedMessageCompanion[SiteNameSetPb] { 67 | implicit def messageCompanion: com.trueaccord.scalapb.GeneratedMessageCompanion[SiteNameSetPb] = this 68 | def fromFieldsMap(__fieldsMap: Map[com.google.protobuf.Descriptors.FieldDescriptor, scala.Any]): com.komanov.serialization.domain.protos.events.SiteNameSetPb = { 69 | require(__fieldsMap.keys.forall(_.getContainingType() == descriptor), "FieldDescriptor does not match message type.") 70 | val __fields = descriptor.getFields 71 | com.komanov.serialization.domain.protos.events.SiteNameSetPb( 72 | __fieldsMap.getOrElse(__fields.get(0), "").asInstanceOf[String] 73 | ) 74 | } 75 | def descriptor: com.google.protobuf.Descriptors.Descriptor = EventsProto.descriptor.getMessageTypes.get(1) 76 | def messageCompanionForField(__field: com.google.protobuf.Descriptors.FieldDescriptor): com.trueaccord.scalapb.GeneratedMessageCompanion[_] = throw new MatchError(__field) 77 | def enumCompanionForField(__field: com.google.protobuf.Descriptors.FieldDescriptor): com.trueaccord.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__field) 78 | lazy val defaultInstance = com.komanov.serialization.domain.protos.events.SiteNameSetPb( 79 | ) 80 | implicit class SiteNameSetPbLens[UpperPB](_l: com.trueaccord.lenses.Lens[UpperPB, SiteNameSetPb]) extends com.trueaccord.lenses.ObjectLens[UpperPB, SiteNameSetPb](_l) { 81 | def name: com.trueaccord.lenses.Lens[UpperPB, String] = field(_.name)((c_, f_) => c_.copy(name = f_)) 82 | } 83 | final val NAME_FIELD_NUMBER = 1 84 | } 85 | -------------------------------------------------------------------------------- /scala-serialization/src/main/scala/com/komanov/serialization/domain/protos/events/SitePublishedPb.scala: -------------------------------------------------------------------------------- 1 | // Generated by the Scala Plugin for the Protocol Buffer Compiler. 2 | // Do not edit! 3 | // 4 | // Protofile syntax: PROTO3 5 | 6 | package com.komanov.serialization.domain.protos.events 7 | 8 | 9 | 10 | @SerialVersionUID(0L) 11 | final case class SitePublishedPb( 12 | ) extends com.trueaccord.scalapb.GeneratedMessage with com.trueaccord.scalapb.Message[SitePublishedPb] with com.trueaccord.lenses.Updatable[SitePublishedPb] { 13 | @transient 14 | private[this] var __serializedSizeCachedValue: Int = 0 15 | private[this] def __computeSerializedValue(): Int = { 16 | var __size = 0 17 | __size 18 | } 19 | final override def serializedSize: Int = { 20 | var read = __serializedSizeCachedValue 21 | if (read == 0) { 22 | read = __computeSerializedValue() 23 | __serializedSizeCachedValue = read 24 | } 25 | read 26 | } 27 | def writeTo(output: com.google.protobuf.CodedOutputStream): Unit = { 28 | } 29 | def mergeFrom(__input: com.google.protobuf.CodedInputStream): com.komanov.serialization.domain.protos.events.SitePublishedPb = { 30 | var _done__ = false 31 | while (!_done__) { 32 | val _tag__ = __input.readTag() 33 | _tag__ match { 34 | case 0 => _done__ = true 35 | case tag => __input.skipField(tag) 36 | } 37 | } 38 | com.komanov.serialization.domain.protos.events.SitePublishedPb( 39 | ) 40 | } 41 | def getField(__field: com.google.protobuf.Descriptors.FieldDescriptor): scala.Any = throw new MatchError(__field) 42 | override def toString: String = com.trueaccord.scalapb.TextFormat.printToUnicodeString(this) 43 | def companion = com.komanov.serialization.domain.protos.events.SitePublishedPb 44 | } 45 | 46 | object SitePublishedPb extends com.trueaccord.scalapb.GeneratedMessageCompanion[SitePublishedPb] { 47 | implicit def messageCompanion: com.trueaccord.scalapb.GeneratedMessageCompanion[SitePublishedPb] = this 48 | def fromFieldsMap(__fieldsMap: Map[com.google.protobuf.Descriptors.FieldDescriptor, scala.Any]): com.komanov.serialization.domain.protos.events.SitePublishedPb = { 49 | require(__fieldsMap.keys.forall(_.getContainingType() == descriptor), "FieldDescriptor does not match message type.") 50 | val __fields = descriptor.getFields 51 | com.komanov.serialization.domain.protos.events.SitePublishedPb( 52 | ) 53 | } 54 | def descriptor: com.google.protobuf.Descriptors.Descriptor = EventsProto.descriptor.getMessageTypes.get(4) 55 | def messageCompanionForField(__field: com.google.protobuf.Descriptors.FieldDescriptor): com.trueaccord.scalapb.GeneratedMessageCompanion[_] = throw new MatchError(__field) 56 | def enumCompanionForField(__field: com.google.protobuf.Descriptors.FieldDescriptor): com.trueaccord.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__field) 57 | lazy val defaultInstance = com.komanov.serialization.domain.protos.events.SitePublishedPb( 58 | ) 59 | implicit class SitePublishedPbLens[UpperPB](_l: com.trueaccord.lenses.Lens[UpperPB, SitePublishedPb]) extends com.trueaccord.lenses.ObjectLens[UpperPB, SitePublishedPb](_l) { 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /scala-serialization/src/main/scala/com/komanov/serialization/domain/protos/events/SiteRevisionSetPb.scala: -------------------------------------------------------------------------------- 1 | // Generated by the Scala Plugin for the Protocol Buffer Compiler. 2 | // Do not edit! 3 | // 4 | // Protofile syntax: PROTO3 5 | 6 | package com.komanov.serialization.domain.protos.events 7 | 8 | 9 | 10 | @SerialVersionUID(0L) 11 | final case class SiteRevisionSetPb( 12 | revision: Long = 0L 13 | ) extends com.trueaccord.scalapb.GeneratedMessage with com.trueaccord.scalapb.Message[SiteRevisionSetPb] with com.trueaccord.lenses.Updatable[SiteRevisionSetPb] { 14 | @transient 15 | private[this] var __serializedSizeCachedValue: Int = 0 16 | private[this] def __computeSerializedValue(): Int = { 17 | var __size = 0 18 | if (revision != 0L) { __size += com.google.protobuf.CodedOutputStream.computeUInt64Size(1, revision) } 19 | __size 20 | } 21 | final override def serializedSize: Int = { 22 | var read = __serializedSizeCachedValue 23 | if (read == 0) { 24 | read = __computeSerializedValue() 25 | __serializedSizeCachedValue = read 26 | } 27 | read 28 | } 29 | def writeTo(output: com.google.protobuf.CodedOutputStream): Unit = { 30 | { 31 | val __v = revision 32 | if (__v != 0L) { 33 | output.writeUInt64(1, __v) 34 | } 35 | }; 36 | } 37 | def mergeFrom(__input: com.google.protobuf.CodedInputStream): com.komanov.serialization.domain.protos.events.SiteRevisionSetPb = { 38 | var __revision = this.revision 39 | var _done__ = false 40 | while (!_done__) { 41 | val _tag__ = __input.readTag() 42 | _tag__ match { 43 | case 0 => _done__ = true 44 | case 8 => 45 | __revision = __input.readUInt64() 46 | case tag => __input.skipField(tag) 47 | } 48 | } 49 | com.komanov.serialization.domain.protos.events.SiteRevisionSetPb( 50 | revision = __revision 51 | ) 52 | } 53 | def withRevision(__v: Long): SiteRevisionSetPb = copy(revision = __v) 54 | def getField(__field: com.google.protobuf.Descriptors.FieldDescriptor): scala.Any = { 55 | __field.getNumber match { 56 | case 1 => { 57 | val __t = revision 58 | if (__t != 0L) __t else null 59 | } 60 | } 61 | } 62 | override def toString: String = com.trueaccord.scalapb.TextFormat.printToUnicodeString(this) 63 | def companion = com.komanov.serialization.domain.protos.events.SiteRevisionSetPb 64 | } 65 | 66 | object SiteRevisionSetPb extends com.trueaccord.scalapb.GeneratedMessageCompanion[SiteRevisionSetPb] { 67 | implicit def messageCompanion: com.trueaccord.scalapb.GeneratedMessageCompanion[SiteRevisionSetPb] = this 68 | def fromFieldsMap(__fieldsMap: Map[com.google.protobuf.Descriptors.FieldDescriptor, scala.Any]): com.komanov.serialization.domain.protos.events.SiteRevisionSetPb = { 69 | require(__fieldsMap.keys.forall(_.getContainingType() == descriptor), "FieldDescriptor does not match message type.") 70 | val __fields = descriptor.getFields 71 | com.komanov.serialization.domain.protos.events.SiteRevisionSetPb( 72 | __fieldsMap.getOrElse(__fields.get(0), 0L).asInstanceOf[Long] 73 | ) 74 | } 75 | def descriptor: com.google.protobuf.Descriptors.Descriptor = EventsProto.descriptor.getMessageTypes.get(3) 76 | def messageCompanionForField(__field: com.google.protobuf.Descriptors.FieldDescriptor): com.trueaccord.scalapb.GeneratedMessageCompanion[_] = throw new MatchError(__field) 77 | def enumCompanionForField(__field: com.google.protobuf.Descriptors.FieldDescriptor): com.trueaccord.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__field) 78 | lazy val defaultInstance = com.komanov.serialization.domain.protos.events.SiteRevisionSetPb( 79 | ) 80 | implicit class SiteRevisionSetPbLens[UpperPB](_l: com.trueaccord.lenses.Lens[UpperPB, SiteRevisionSetPb]) extends com.trueaccord.lenses.ObjectLens[UpperPB, SiteRevisionSetPb](_l) { 81 | def revision: com.trueaccord.lenses.Lens[UpperPB, Long] = field(_.revision)((c_, f_) => c_.copy(revision = f_)) 82 | } 83 | final val REVISION_FIELD_NUMBER = 1 84 | } 85 | -------------------------------------------------------------------------------- /scala-serialization/src/main/scala/com/komanov/serialization/domain/protos/events/SiteUnpublishedPb.scala: -------------------------------------------------------------------------------- 1 | // Generated by the Scala Plugin for the Protocol Buffer Compiler. 2 | // Do not edit! 3 | // 4 | // Protofile syntax: PROTO3 5 | 6 | package com.komanov.serialization.domain.protos.events 7 | 8 | 9 | 10 | @SerialVersionUID(0L) 11 | final case class SiteUnpublishedPb( 12 | ) extends com.trueaccord.scalapb.GeneratedMessage with com.trueaccord.scalapb.Message[SiteUnpublishedPb] with com.trueaccord.lenses.Updatable[SiteUnpublishedPb] { 13 | @transient 14 | private[this] var __serializedSizeCachedValue: Int = 0 15 | private[this] def __computeSerializedValue(): Int = { 16 | var __size = 0 17 | __size 18 | } 19 | final override def serializedSize: Int = { 20 | var read = __serializedSizeCachedValue 21 | if (read == 0) { 22 | read = __computeSerializedValue() 23 | __serializedSizeCachedValue = read 24 | } 25 | read 26 | } 27 | def writeTo(output: com.google.protobuf.CodedOutputStream): Unit = { 28 | } 29 | def mergeFrom(__input: com.google.protobuf.CodedInputStream): com.komanov.serialization.domain.protos.events.SiteUnpublishedPb = { 30 | var _done__ = false 31 | while (!_done__) { 32 | val _tag__ = __input.readTag() 33 | _tag__ match { 34 | case 0 => _done__ = true 35 | case tag => __input.skipField(tag) 36 | } 37 | } 38 | com.komanov.serialization.domain.protos.events.SiteUnpublishedPb( 39 | ) 40 | } 41 | def getField(__field: com.google.protobuf.Descriptors.FieldDescriptor): scala.Any = throw new MatchError(__field) 42 | override def toString: String = com.trueaccord.scalapb.TextFormat.printToUnicodeString(this) 43 | def companion = com.komanov.serialization.domain.protos.events.SiteUnpublishedPb 44 | } 45 | 46 | object SiteUnpublishedPb extends com.trueaccord.scalapb.GeneratedMessageCompanion[SiteUnpublishedPb] { 47 | implicit def messageCompanion: com.trueaccord.scalapb.GeneratedMessageCompanion[SiteUnpublishedPb] = this 48 | def fromFieldsMap(__fieldsMap: Map[com.google.protobuf.Descriptors.FieldDescriptor, scala.Any]): com.komanov.serialization.domain.protos.events.SiteUnpublishedPb = { 49 | require(__fieldsMap.keys.forall(_.getContainingType() == descriptor), "FieldDescriptor does not match message type.") 50 | val __fields = descriptor.getFields 51 | com.komanov.serialization.domain.protos.events.SiteUnpublishedPb( 52 | ) 53 | } 54 | def descriptor: com.google.protobuf.Descriptors.Descriptor = EventsProto.descriptor.getMessageTypes.get(5) 55 | def messageCompanionForField(__field: com.google.protobuf.Descriptors.FieldDescriptor): com.trueaccord.scalapb.GeneratedMessageCompanion[_] = throw new MatchError(__field) 56 | def enumCompanionForField(__field: com.google.protobuf.Descriptors.FieldDescriptor): com.trueaccord.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__field) 57 | lazy val defaultInstance = com.komanov.serialization.domain.protos.events.SiteUnpublishedPb( 58 | ) 59 | implicit class SiteUnpublishedPbLens[UpperPB](_l: com.trueaccord.lenses.Lens[UpperPB, SiteUnpublishedPb]) extends com.trueaccord.lenses.ObjectLens[UpperPB, SiteUnpublishedPb](_l) { 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /scala-serialization/src/main/scala/com/komanov/serialization/domain/protos/events/TextComponentDataSetPb.scala: -------------------------------------------------------------------------------- 1 | // Generated by the Scala Plugin for the Protocol Buffer Compiler. 2 | // Do not edit! 3 | // 4 | // Protofile syntax: PROTO3 5 | 6 | package com.komanov.serialization.domain.protos.events 7 | 8 | 9 | 10 | @SerialVersionUID(0L) 11 | final case class TextComponentDataSetPb( 12 | id: com.google.protobuf.ByteString = com.google.protobuf.ByteString.EMPTY, 13 | text: String = "" 14 | ) extends com.trueaccord.scalapb.GeneratedMessage with com.trueaccord.scalapb.Message[TextComponentDataSetPb] with com.trueaccord.lenses.Updatable[TextComponentDataSetPb] { 15 | @transient 16 | private[this] var __serializedSizeCachedValue: Int = 0 17 | private[this] def __computeSerializedValue(): Int = { 18 | var __size = 0 19 | if (id != com.google.protobuf.ByteString.EMPTY) { __size += com.google.protobuf.CodedOutputStream.computeBytesSize(1, id) } 20 | if (text != "") { __size += com.google.protobuf.CodedOutputStream.computeStringSize(2, text) } 21 | __size 22 | } 23 | final override def serializedSize: Int = { 24 | var read = __serializedSizeCachedValue 25 | if (read == 0) { 26 | read = __computeSerializedValue() 27 | __serializedSizeCachedValue = read 28 | } 29 | read 30 | } 31 | def writeTo(output: com.google.protobuf.CodedOutputStream): Unit = { 32 | { 33 | val __v = id 34 | if (__v != com.google.protobuf.ByteString.EMPTY) { 35 | output.writeBytes(1, __v) 36 | } 37 | }; 38 | { 39 | val __v = text 40 | if (__v != "") { 41 | output.writeString(2, __v) 42 | } 43 | }; 44 | } 45 | def mergeFrom(__input: com.google.protobuf.CodedInputStream): com.komanov.serialization.domain.protos.events.TextComponentDataSetPb = { 46 | var __id = this.id 47 | var __text = this.text 48 | var _done__ = false 49 | while (!_done__) { 50 | val _tag__ = __input.readTag() 51 | _tag__ match { 52 | case 0 => _done__ = true 53 | case 10 => 54 | __id = __input.readBytes() 55 | case 18 => 56 | __text = __input.readString() 57 | case tag => __input.skipField(tag) 58 | } 59 | } 60 | com.komanov.serialization.domain.protos.events.TextComponentDataSetPb( 61 | id = __id, 62 | text = __text 63 | ) 64 | } 65 | def withId(__v: com.google.protobuf.ByteString): TextComponentDataSetPb = copy(id = __v) 66 | def withText(__v: String): TextComponentDataSetPb = copy(text = __v) 67 | def getField(__field: com.google.protobuf.Descriptors.FieldDescriptor): scala.Any = { 68 | __field.getNumber match { 69 | case 1 => { 70 | val __t = id 71 | if (__t != com.google.protobuf.ByteString.EMPTY) __t else null 72 | } 73 | case 2 => { 74 | val __t = text 75 | if (__t != "") __t else null 76 | } 77 | } 78 | } 79 | override def toString: String = com.trueaccord.scalapb.TextFormat.printToUnicodeString(this) 80 | def companion = com.komanov.serialization.domain.protos.events.TextComponentDataSetPb 81 | } 82 | 83 | object TextComponentDataSetPb extends com.trueaccord.scalapb.GeneratedMessageCompanion[TextComponentDataSetPb] { 84 | implicit def messageCompanion: com.trueaccord.scalapb.GeneratedMessageCompanion[TextComponentDataSetPb] = this 85 | def fromFieldsMap(__fieldsMap: Map[com.google.protobuf.Descriptors.FieldDescriptor, scala.Any]): com.komanov.serialization.domain.protos.events.TextComponentDataSetPb = { 86 | require(__fieldsMap.keys.forall(_.getContainingType() == descriptor), "FieldDescriptor does not match message type.") 87 | val __fields = descriptor.getFields 88 | com.komanov.serialization.domain.protos.events.TextComponentDataSetPb( 89 | __fieldsMap.getOrElse(__fields.get(0), com.google.protobuf.ByteString.EMPTY).asInstanceOf[com.google.protobuf.ByteString], 90 | __fieldsMap.getOrElse(__fields.get(1), "").asInstanceOf[String] 91 | ) 92 | } 93 | def descriptor: com.google.protobuf.Descriptors.Descriptor = EventsProto.descriptor.getMessageTypes.get(22) 94 | def messageCompanionForField(__field: com.google.protobuf.Descriptors.FieldDescriptor): com.trueaccord.scalapb.GeneratedMessageCompanion[_] = throw new MatchError(__field) 95 | def enumCompanionForField(__field: com.google.protobuf.Descriptors.FieldDescriptor): com.trueaccord.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__field) 96 | lazy val defaultInstance = com.komanov.serialization.domain.protos.events.TextComponentDataSetPb( 97 | ) 98 | implicit class TextComponentDataSetPbLens[UpperPB](_l: com.trueaccord.lenses.Lens[UpperPB, TextComponentDataSetPb]) extends com.trueaccord.lenses.ObjectLens[UpperPB, TextComponentDataSetPb](_l) { 99 | def id: com.trueaccord.lenses.Lens[UpperPB, com.google.protobuf.ByteString] = field(_.id)((c_, f_) => c_.copy(id = f_)) 100 | def text: com.trueaccord.lenses.Lens[UpperPB, String] = field(_.text)((c_, f_) => c_.copy(text = f_)) 101 | } 102 | final val ID_FIELD_NUMBER = 1 103 | final val TEXT_FIELD_NUMBER = 2 104 | } 105 | -------------------------------------------------------------------------------- /scala-serialization/src/main/scala/com/komanov/serialization/domain/protos/site/DomainPb.scala: -------------------------------------------------------------------------------- 1 | // Generated by the Scala Plugin for the Protocol Buffer Compiler. 2 | // Do not edit! 3 | // 4 | // Protofile syntax: PROTO3 5 | 6 | package com.komanov.serialization.domain.protos.site 7 | 8 | 9 | 10 | @SerialVersionUID(0L) 11 | final case class DomainPb( 12 | name: String = "", 13 | primary: Boolean = false 14 | ) extends com.trueaccord.scalapb.GeneratedMessage with com.trueaccord.scalapb.Message[DomainPb] with com.trueaccord.lenses.Updatable[DomainPb] { 15 | @transient 16 | private[this] var __serializedSizeCachedValue: Int = 0 17 | private[this] def __computeSerializedValue(): Int = { 18 | var __size = 0 19 | if (name != "") { __size += com.google.protobuf.CodedOutputStream.computeStringSize(1, name) } 20 | if (primary != false) { __size += com.google.protobuf.CodedOutputStream.computeBoolSize(2, primary) } 21 | __size 22 | } 23 | final override def serializedSize: Int = { 24 | var read = __serializedSizeCachedValue 25 | if (read == 0) { 26 | read = __computeSerializedValue() 27 | __serializedSizeCachedValue = read 28 | } 29 | read 30 | } 31 | def writeTo(output: com.google.protobuf.CodedOutputStream): Unit = { 32 | { 33 | val __v = name 34 | if (__v != "") { 35 | output.writeString(1, __v) 36 | } 37 | }; 38 | { 39 | val __v = primary 40 | if (__v != false) { 41 | output.writeBool(2, __v) 42 | } 43 | }; 44 | } 45 | def mergeFrom(__input: com.google.protobuf.CodedInputStream): com.komanov.serialization.domain.protos.site.DomainPb = { 46 | var __name = this.name 47 | var __primary = this.primary 48 | var _done__ = false 49 | while (!_done__) { 50 | val _tag__ = __input.readTag() 51 | _tag__ match { 52 | case 0 => _done__ = true 53 | case 10 => 54 | __name = __input.readString() 55 | case 16 => 56 | __primary = __input.readBool() 57 | case tag => __input.skipField(tag) 58 | } 59 | } 60 | com.komanov.serialization.domain.protos.site.DomainPb( 61 | name = __name, 62 | primary = __primary 63 | ) 64 | } 65 | def withName(__v: String): DomainPb = copy(name = __v) 66 | def withPrimary(__v: Boolean): DomainPb = copy(primary = __v) 67 | def getField(__field: com.google.protobuf.Descriptors.FieldDescriptor): scala.Any = { 68 | __field.getNumber match { 69 | case 1 => { 70 | val __t = name 71 | if (__t != "") __t else null 72 | } 73 | case 2 => { 74 | val __t = primary 75 | if (__t != false) __t else null 76 | } 77 | } 78 | } 79 | override def toString: String = com.trueaccord.scalapb.TextFormat.printToUnicodeString(this) 80 | def companion = com.komanov.serialization.domain.protos.site.DomainPb 81 | } 82 | 83 | object DomainPb extends com.trueaccord.scalapb.GeneratedMessageCompanion[DomainPb] { 84 | implicit def messageCompanion: com.trueaccord.scalapb.GeneratedMessageCompanion[DomainPb] = this 85 | def fromFieldsMap(__fieldsMap: Map[com.google.protobuf.Descriptors.FieldDescriptor, scala.Any]): com.komanov.serialization.domain.protos.site.DomainPb = { 86 | require(__fieldsMap.keys.forall(_.getContainingType() == descriptor), "FieldDescriptor does not match message type.") 87 | val __fields = descriptor.getFields 88 | com.komanov.serialization.domain.protos.site.DomainPb( 89 | __fieldsMap.getOrElse(__fields.get(0), "").asInstanceOf[String], 90 | __fieldsMap.getOrElse(__fields.get(1), false).asInstanceOf[Boolean] 91 | ) 92 | } 93 | def descriptor: com.google.protobuf.Descriptors.Descriptor = SiteProto.descriptor.getMessageTypes.get(0) 94 | def messageCompanionForField(__field: com.google.protobuf.Descriptors.FieldDescriptor): com.trueaccord.scalapb.GeneratedMessageCompanion[_] = throw new MatchError(__field) 95 | def enumCompanionForField(__field: com.google.protobuf.Descriptors.FieldDescriptor): com.trueaccord.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__field) 96 | lazy val defaultInstance = com.komanov.serialization.domain.protos.site.DomainPb( 97 | ) 98 | implicit class DomainPbLens[UpperPB](_l: com.trueaccord.lenses.Lens[UpperPB, DomainPb]) extends com.trueaccord.lenses.ObjectLens[UpperPB, DomainPb](_l) { 99 | def name: com.trueaccord.lenses.Lens[UpperPB, String] = field(_.name)((c_, f_) => c_.copy(name = f_)) 100 | def primary: com.trueaccord.lenses.Lens[UpperPB, Boolean] = field(_.primary)((c_, f_) => c_.copy(primary = f_)) 101 | } 102 | final val NAME_FIELD_NUMBER = 1 103 | final val PRIMARY_FIELD_NUMBER = 2 104 | } 105 | -------------------------------------------------------------------------------- /scala-serialization/src/main/scala/com/komanov/serialization/domain/protos/site/MetaTagPb.scala: -------------------------------------------------------------------------------- 1 | // Generated by the Scala Plugin for the Protocol Buffer Compiler. 2 | // Do not edit! 3 | // 4 | // Protofile syntax: PROTO3 5 | 6 | package com.komanov.serialization.domain.protos.site 7 | 8 | 9 | 10 | @SerialVersionUID(0L) 11 | final case class MetaTagPb( 12 | name: String = "", 13 | value: String = "" 14 | ) extends com.trueaccord.scalapb.GeneratedMessage with com.trueaccord.scalapb.Message[MetaTagPb] with com.trueaccord.lenses.Updatable[MetaTagPb] { 15 | @transient 16 | private[this] var __serializedSizeCachedValue: Int = 0 17 | private[this] def __computeSerializedValue(): Int = { 18 | var __size = 0 19 | if (name != "") { __size += com.google.protobuf.CodedOutputStream.computeStringSize(1, name) } 20 | if (value != "") { __size += com.google.protobuf.CodedOutputStream.computeStringSize(2, value) } 21 | __size 22 | } 23 | final override def serializedSize: Int = { 24 | var read = __serializedSizeCachedValue 25 | if (read == 0) { 26 | read = __computeSerializedValue() 27 | __serializedSizeCachedValue = read 28 | } 29 | read 30 | } 31 | def writeTo(output: com.google.protobuf.CodedOutputStream): Unit = { 32 | { 33 | val __v = name 34 | if (__v != "") { 35 | output.writeString(1, __v) 36 | } 37 | }; 38 | { 39 | val __v = value 40 | if (__v != "") { 41 | output.writeString(2, __v) 42 | } 43 | }; 44 | } 45 | def mergeFrom(__input: com.google.protobuf.CodedInputStream): com.komanov.serialization.domain.protos.site.MetaTagPb = { 46 | var __name = this.name 47 | var __value = this.value 48 | var _done__ = false 49 | while (!_done__) { 50 | val _tag__ = __input.readTag() 51 | _tag__ match { 52 | case 0 => _done__ = true 53 | case 10 => 54 | __name = __input.readString() 55 | case 18 => 56 | __value = __input.readString() 57 | case tag => __input.skipField(tag) 58 | } 59 | } 60 | com.komanov.serialization.domain.protos.site.MetaTagPb( 61 | name = __name, 62 | value = __value 63 | ) 64 | } 65 | def withName(__v: String): MetaTagPb = copy(name = __v) 66 | def withValue(__v: String): MetaTagPb = copy(value = __v) 67 | def getField(__field: com.google.protobuf.Descriptors.FieldDescriptor): scala.Any = { 68 | __field.getNumber match { 69 | case 1 => { 70 | val __t = name 71 | if (__t != "") __t else null 72 | } 73 | case 2 => { 74 | val __t = value 75 | if (__t != "") __t else null 76 | } 77 | } 78 | } 79 | override def toString: String = com.trueaccord.scalapb.TextFormat.printToUnicodeString(this) 80 | def companion = com.komanov.serialization.domain.protos.site.MetaTagPb 81 | } 82 | 83 | object MetaTagPb extends com.trueaccord.scalapb.GeneratedMessageCompanion[MetaTagPb] { 84 | implicit def messageCompanion: com.trueaccord.scalapb.GeneratedMessageCompanion[MetaTagPb] = this 85 | def fromFieldsMap(__fieldsMap: Map[com.google.protobuf.Descriptors.FieldDescriptor, scala.Any]): com.komanov.serialization.domain.protos.site.MetaTagPb = { 86 | require(__fieldsMap.keys.forall(_.getContainingType() == descriptor), "FieldDescriptor does not match message type.") 87 | val __fields = descriptor.getFields 88 | com.komanov.serialization.domain.protos.site.MetaTagPb( 89 | __fieldsMap.getOrElse(__fields.get(0), "").asInstanceOf[String], 90 | __fieldsMap.getOrElse(__fields.get(1), "").asInstanceOf[String] 91 | ) 92 | } 93 | def descriptor: com.google.protobuf.Descriptors.Descriptor = SiteProto.descriptor.getMessageTypes.get(2) 94 | def messageCompanionForField(__field: com.google.protobuf.Descriptors.FieldDescriptor): com.trueaccord.scalapb.GeneratedMessageCompanion[_] = throw new MatchError(__field) 95 | def enumCompanionForField(__field: com.google.protobuf.Descriptors.FieldDescriptor): com.trueaccord.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__field) 96 | lazy val defaultInstance = com.komanov.serialization.domain.protos.site.MetaTagPb( 97 | ) 98 | implicit class MetaTagPbLens[UpperPB](_l: com.trueaccord.lenses.Lens[UpperPB, MetaTagPb]) extends com.trueaccord.lenses.ObjectLens[UpperPB, MetaTagPb](_l) { 99 | def name: com.trueaccord.lenses.Lens[UpperPB, String] = field(_.name)((c_, f_) => c_.copy(name = f_)) 100 | def value: com.trueaccord.lenses.Lens[UpperPB, String] = field(_.value)((c_, f_) => c_.copy(value = f_)) 101 | } 102 | final val NAME_FIELD_NUMBER = 1 103 | final val VALUE_FIELD_NUMBER = 2 104 | } 105 | -------------------------------------------------------------------------------- /scala-serialization/src/main/scala/com/komanov/serialization/domain/protos/site/PageComponentPositionPb.scala: -------------------------------------------------------------------------------- 1 | // Generated by the Scala Plugin for the Protocol Buffer Compiler. 2 | // Do not edit! 3 | // 4 | // Protofile syntax: PROTO3 5 | 6 | package com.komanov.serialization.domain.protos.site 7 | 8 | 9 | 10 | @SerialVersionUID(0L) 11 | final case class PageComponentPositionPb( 12 | x: Int = 0, 13 | y: Int = 0 14 | ) extends com.trueaccord.scalapb.GeneratedMessage with com.trueaccord.scalapb.Message[PageComponentPositionPb] with com.trueaccord.lenses.Updatable[PageComponentPositionPb] { 15 | @transient 16 | private[this] var __serializedSizeCachedValue: Int = 0 17 | private[this] def __computeSerializedValue(): Int = { 18 | var __size = 0 19 | if (x != 0) { __size += com.google.protobuf.CodedOutputStream.computeUInt32Size(1, x) } 20 | if (y != 0) { __size += com.google.protobuf.CodedOutputStream.computeUInt32Size(2, y) } 21 | __size 22 | } 23 | final override def serializedSize: Int = { 24 | var read = __serializedSizeCachedValue 25 | if (read == 0) { 26 | read = __computeSerializedValue() 27 | __serializedSizeCachedValue = read 28 | } 29 | read 30 | } 31 | def writeTo(output: com.google.protobuf.CodedOutputStream): Unit = { 32 | { 33 | val __v = x 34 | if (__v != 0) { 35 | output.writeUInt32(1, __v) 36 | } 37 | }; 38 | { 39 | val __v = y 40 | if (__v != 0) { 41 | output.writeUInt32(2, __v) 42 | } 43 | }; 44 | } 45 | def mergeFrom(__input: com.google.protobuf.CodedInputStream): com.komanov.serialization.domain.protos.site.PageComponentPositionPb = { 46 | var __x = this.x 47 | var __y = this.y 48 | var _done__ = false 49 | while (!_done__) { 50 | val _tag__ = __input.readTag() 51 | _tag__ match { 52 | case 0 => _done__ = true 53 | case 8 => 54 | __x = __input.readUInt32() 55 | case 16 => 56 | __y = __input.readUInt32() 57 | case tag => __input.skipField(tag) 58 | } 59 | } 60 | com.komanov.serialization.domain.protos.site.PageComponentPositionPb( 61 | x = __x, 62 | y = __y 63 | ) 64 | } 65 | def withX(__v: Int): PageComponentPositionPb = copy(x = __v) 66 | def withY(__v: Int): PageComponentPositionPb = copy(y = __v) 67 | def getField(__field: com.google.protobuf.Descriptors.FieldDescriptor): scala.Any = { 68 | __field.getNumber match { 69 | case 1 => { 70 | val __t = x 71 | if (__t != 0) __t else null 72 | } 73 | case 2 => { 74 | val __t = y 75 | if (__t != 0) __t else null 76 | } 77 | } 78 | } 79 | override def toString: String = com.trueaccord.scalapb.TextFormat.printToUnicodeString(this) 80 | def companion = com.komanov.serialization.domain.protos.site.PageComponentPositionPb 81 | } 82 | 83 | object PageComponentPositionPb extends com.trueaccord.scalapb.GeneratedMessageCompanion[PageComponentPositionPb] { 84 | implicit def messageCompanion: com.trueaccord.scalapb.GeneratedMessageCompanion[PageComponentPositionPb] = this 85 | def fromFieldsMap(__fieldsMap: Map[com.google.protobuf.Descriptors.FieldDescriptor, scala.Any]): com.komanov.serialization.domain.protos.site.PageComponentPositionPb = { 86 | require(__fieldsMap.keys.forall(_.getContainingType() == descriptor), "FieldDescriptor does not match message type.") 87 | val __fields = descriptor.getFields 88 | com.komanov.serialization.domain.protos.site.PageComponentPositionPb( 89 | __fieldsMap.getOrElse(__fields.get(0), 0).asInstanceOf[Int], 90 | __fieldsMap.getOrElse(__fields.get(1), 0).asInstanceOf[Int] 91 | ) 92 | } 93 | def descriptor: com.google.protobuf.Descriptors.Descriptor = SiteProto.descriptor.getMessageTypes.get(4) 94 | def messageCompanionForField(__field: com.google.protobuf.Descriptors.FieldDescriptor): com.trueaccord.scalapb.GeneratedMessageCompanion[_] = throw new MatchError(__field) 95 | def enumCompanionForField(__field: com.google.protobuf.Descriptors.FieldDescriptor): com.trueaccord.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__field) 96 | lazy val defaultInstance = com.komanov.serialization.domain.protos.site.PageComponentPositionPb( 97 | ) 98 | implicit class PageComponentPositionPbLens[UpperPB](_l: com.trueaccord.lenses.Lens[UpperPB, PageComponentPositionPb]) extends com.trueaccord.lenses.ObjectLens[UpperPB, PageComponentPositionPb](_l) { 99 | def x: com.trueaccord.lenses.Lens[UpperPB, Int] = field(_.x)((c_, f_) => c_.copy(x = f_)) 100 | def y: com.trueaccord.lenses.Lens[UpperPB, Int] = field(_.y)((c_, f_) => c_.copy(y = f_)) 101 | } 102 | final val X_FIELD_NUMBER = 1 103 | final val Y_FIELD_NUMBER = 2 104 | } 105 | -------------------------------------------------------------------------------- /scala-serialization/src/main/scala/com/komanov/serialization/domain/protos/site/PageComponentTypePb.scala: -------------------------------------------------------------------------------- 1 | // Generated by the Scala Plugin for the Protocol Buffer Compiler. 2 | // Do not edit! 3 | // 4 | // Protofile syntax: PROTO3 5 | 6 | package com.komanov.serialization.domain.protos.site 7 | 8 | 9 | 10 | sealed trait PageComponentTypePb extends com.trueaccord.scalapb.GeneratedEnum { 11 | type EnumType = PageComponentTypePb 12 | def isUnknownPageComponentType: Boolean = false 13 | def isText: Boolean = false 14 | def isButton: Boolean = false 15 | def isBlog: Boolean = false 16 | def isUnrecognized: Boolean = false 17 | def companion: com.trueaccord.scalapb.GeneratedEnumCompanion[PageComponentTypePb] = PageComponentTypePb 18 | } 19 | 20 | object PageComponentTypePb extends com.trueaccord.scalapb.GeneratedEnumCompanion[PageComponentTypePb] { 21 | implicit def enumCompanion: com.trueaccord.scalapb.GeneratedEnumCompanion[PageComponentTypePb] = this 22 | @SerialVersionUID(0L) 23 | case object UnknownPageComponentType extends PageComponentTypePb { 24 | val value = 0 25 | val index = 0 26 | val name = "UnknownPageComponentType" 27 | override def isUnknownPageComponentType: Boolean = true 28 | } 29 | 30 | @SerialVersionUID(0L) 31 | case object Text extends PageComponentTypePb { 32 | val value = 1 33 | val index = 1 34 | val name = "Text" 35 | override def isText: Boolean = true 36 | } 37 | 38 | @SerialVersionUID(0L) 39 | case object Button extends PageComponentTypePb { 40 | val value = 2 41 | val index = 2 42 | val name = "Button" 43 | override def isButton: Boolean = true 44 | } 45 | 46 | @SerialVersionUID(0L) 47 | case object Blog extends PageComponentTypePb { 48 | val value = 3 49 | val index = 3 50 | val name = "Blog" 51 | override def isBlog: Boolean = true 52 | } 53 | 54 | @SerialVersionUID(0L) 55 | case class Unrecognized(value: Int) extends PageComponentTypePb { 56 | val name = "UNRECOGNIZED" 57 | val index = -1 58 | override def isUnrecognized: Boolean = true 59 | } 60 | 61 | lazy val values = Seq(UnknownPageComponentType, Text, Button, Blog) 62 | def fromValue(value: Int): PageComponentTypePb = value match { 63 | case 0 => UnknownPageComponentType 64 | case 1 => Text 65 | case 2 => Button 66 | case 3 => Blog 67 | case __other => Unrecognized(__other) 68 | } 69 | def descriptor: com.google.protobuf.Descriptors.EnumDescriptor = SiteProto.descriptor.getEnumTypes.get(2) 70 | } -------------------------------------------------------------------------------- /scala-serialization/src/main/scala/com/komanov/serialization/domain/protos/site/SiteFlagPb.scala: -------------------------------------------------------------------------------- 1 | // Generated by the Scala Plugin for the Protocol Buffer Compiler. 2 | // Do not edit! 3 | // 4 | // Protofile syntax: PROTO3 5 | 6 | package com.komanov.serialization.domain.protos.site 7 | 8 | 9 | 10 | sealed trait SiteFlagPb extends com.trueaccord.scalapb.GeneratedEnum { 11 | type EnumType = SiteFlagPb 12 | def isUnknownSiteFlag: Boolean = false 13 | def isFree: Boolean = false 14 | def isPremium: Boolean = false 15 | def isUnrecognized: Boolean = false 16 | def companion: com.trueaccord.scalapb.GeneratedEnumCompanion[SiteFlagPb] = SiteFlagPb 17 | } 18 | 19 | object SiteFlagPb extends com.trueaccord.scalapb.GeneratedEnumCompanion[SiteFlagPb] { 20 | implicit def enumCompanion: com.trueaccord.scalapb.GeneratedEnumCompanion[SiteFlagPb] = this 21 | @SerialVersionUID(0L) 22 | case object UnknownSiteFlag extends SiteFlagPb { 23 | val value = 0 24 | val index = 0 25 | val name = "UnknownSiteFlag" 26 | override def isUnknownSiteFlag: Boolean = true 27 | } 28 | 29 | @SerialVersionUID(0L) 30 | case object Free extends SiteFlagPb { 31 | val value = 1 32 | val index = 1 33 | val name = "Free" 34 | override def isFree: Boolean = true 35 | } 36 | 37 | @SerialVersionUID(0L) 38 | case object Premium extends SiteFlagPb { 39 | val value = 2 40 | val index = 2 41 | val name = "Premium" 42 | override def isPremium: Boolean = true 43 | } 44 | 45 | @SerialVersionUID(0L) 46 | case class Unrecognized(value: Int) extends SiteFlagPb { 47 | val name = "UNRECOGNIZED" 48 | val index = -1 49 | override def isUnrecognized: Boolean = true 50 | } 51 | 52 | lazy val values = Seq(UnknownSiteFlag, Free, Premium) 53 | def fromValue(value: Int): SiteFlagPb = value match { 54 | case 0 => UnknownSiteFlag 55 | case 1 => Free 56 | case 2 => Premium 57 | case __other => Unrecognized(__other) 58 | } 59 | def descriptor: com.google.protobuf.Descriptors.EnumDescriptor = SiteProto.descriptor.getEnumTypes.get(1) 60 | } -------------------------------------------------------------------------------- /scala-serialization/src/main/scala/com/komanov/serialization/domain/protos/site/SiteProto.scala: -------------------------------------------------------------------------------- 1 | // Generated by the Scala Plugin for the Protocol Buffer Compiler. 2 | // Do not edit! 3 | // 4 | // Protofile syntax: PROTO3 5 | 6 | package com.komanov.serialization.domain.protos.site 7 | 8 | 9 | 10 | object SiteProto { 11 | lazy val descriptor: com.google.protobuf.Descriptors.FileDescriptor = { 12 | val proto = com.google.protobuf.DescriptorProtos.FileDescriptorProto.parseFrom( 13 | com.trueaccord.scalapb.Encoding.fromBase64(Seq( 14 | """ChlzcmMvbWFpbi9wcm90by9zaXRlLnByb3RvEidjb20ua29tYW5vdi5zZXJpYWxpemF0aW9uLmRvbWFpbi5wcm90b3MiOAoIR 15 | G9tYWluUGISEgoEbmFtZRgBIAEoCVIEbmFtZRIYCgdwcmltYXJ5GAIgASgIUgdwcmltYXJ5IoQDCgxFbnRyeVBvaW50UGISYgoGZ 16 | G9tYWluGAEgASgLMkguY29tLmtvbWFub3Yuc2VyaWFsaXphdGlvbi5kb21haW4ucHJvdG9zLkVudHJ5UG9pbnRQYi5Eb21haW5Fb 17 | nRyeVBvaW50UGJIAFIGZG9tYWluElwKBGZyZWUYAiABKAsyRi5jb20ua29tYW5vdi5zZXJpYWxpemF0aW9uLmRvbWFpbi5wcm90b 18 | 3MuRW50cnlQb2ludFBiLkZyZWVFbnRyeVBvaW50UGJIAFIEZnJlZRpGChJEb21haW5FbnRyeVBvaW50UGISFgoGZG9tYWluGAEgA 19 | SgJUgZkb21haW4SGAoHcHJpbWFyeRgCIAEoCFIHcHJpbWFyeRpkChBGcmVlRW50cnlQb2ludFBiEhoKCHVzZXJOYW1lGAEgASgJU 20 | gh1c2VyTmFtZRIaCghzaXRlTmFtZRgCIAEoCVIIc2l0ZU5hbWUSGAoHcHJpbWFyeRgDIAEoCFIHcHJpbWFyeUIECgJlcCI1CglNZ 21 | XRhVGFnUGISEgoEbmFtZRgBIAEoCVIEbmFtZRIUCgV2YWx1ZRgCIAEoCVIFdmFsdWUisAQKE1BhZ2VDb21wb25lbnREYXRhUGISZ 22 | goEdGV4dBgBIAEoCzJQLmNvbS5rb21hbm92LnNlcmlhbGl6YXRpb24uZG9tYWluLnByb3Rvcy5QYWdlQ29tcG9uZW50RGF0YVBiL 23 | lRleHRDb21wb25lbnREYXRhUGJIAFIEdGV4dBJsCgZidXR0b24YAiABKAsyUi5jb20ua29tYW5vdi5zZXJpYWxpemF0aW9uLmRvb 24 | WFpbi5wcm90b3MuUGFnZUNvbXBvbmVudERhdGFQYi5CdXR0b25Db21wb25lbnREYXRhUGJIAFIGYnV0dG9uEmYKBGJsb2cYAyABK 25 | AsyUC5jb20ua29tYW5vdi5zZXJpYWxpemF0aW9uLmRvbWFpbi5wcm90b3MuUGFnZUNvbXBvbmVudERhdGFQYi5CbG9nQ29tcG9uZ 26 | W50RGF0YVBiSABSBGJsb2caKQoTVGV4dENvbXBvbmVudERhdGFQYhISCgR0ZXh0GAEgASgJUgR0ZXh0GlcKFUJ1dHRvbkNvbXBvb 27 | mVudERhdGFQYhISCgRuYW1lGAEgASgJUgRuYW1lEhIKBHRleHQYAiABKAlSBHRleHQSFgoGYWN0aW9uGAMgASgMUgZhY3Rpb24aT 28 | woTQmxvZ0NvbXBvbmVudERhdGFQYhISCgRuYW1lGAEgASgJUgRuYW1lEhAKA3JzcxgCIAEoCFIDcnNzEhIKBHRhZ3MYAyABKAhSB 29 | HRhZ3NCBgoEZGF0YSI1ChdQYWdlQ29tcG9uZW50UG9zaXRpb25QYhIMCgF4GAEgASgNUgF4EgwKAXkYAiABKA1SAXki+QIKD1BhZ 30 | 2VDb21wb25lbnRQYhIOCgJpZBgBIAEoDFICaWQSYgoNY29tcG9uZW50VHlwZRgCIAEoDjI8LmNvbS5rb21hbm92LnNlcmlhbGl6Y 31 | XRpb24uZG9tYWluLnByb3Rvcy5QYWdlQ29tcG9uZW50VHlwZVBiUg1jb21wb25lbnRUeXBlElAKBGRhdGEYAyABKAsyPC5jb20ua 32 | 29tYW5vdi5zZXJpYWxpemF0aW9uLmRvbWFpbi5wcm90b3MuUGFnZUNvbXBvbmVudERhdGFQYlIEZGF0YRJcCghwb3NpdGlvbhgEI 33 | AEoCzJALmNvbS5rb21hbm92LnNlcmlhbGl6YXRpb24uZG9tYWluLnByb3Rvcy5QYWdlQ29tcG9uZW50UG9zaXRpb25QYlIIcG9za 34 | XRpb24SIAoLZGF0ZUNyZWF0ZWQYBSABKARSC2RhdGVDcmVhdGVkEiAKC2RhdGVVcGRhdGVkGAYgASgEUgtkYXRlVXBkYXRlZCLaA 35 | QoGUGFnZVBiEhIKBG5hbWUYASABKAlSBG5hbWUSEgoEcGF0aBgCIAEoCVIEcGF0aBJOCghtZXRhVGFncxgDIAMoCzIyLmNvbS5rb 36 | 21hbm92LnNlcmlhbGl6YXRpb24uZG9tYWluLnByb3Rvcy5NZXRhVGFnUGJSCG1ldGFUYWdzElgKCmNvbXBvbmVudHMYBCADKAsyO 37 | C5jb20ua29tYW5vdi5zZXJpYWxpemF0aW9uLmRvbWFpbi5wcm90b3MuUGFnZUNvbXBvbmVudFBiUgpjb21wb25lbnRzIs0FCgZTa 38 | XRlUGISDgoCaWQYASABKAxSAmlkEhgKB293bmVySWQYAiABKAxSB293bmVySWQSGgoIcmV2aXNpb24YAyABKARSCHJldmlzaW9uE 39 | k8KCHNpdGVUeXBlGAQgASgOMjMuY29tLmtvbWFub3Yuc2VyaWFsaXphdGlvbi5kb21haW4ucHJvdG9zLlNpdGVUeXBlUGJSCHNpd 40 | GVUeXBlEkkKBWZsYWdzGAUgAygOMjMuY29tLmtvbWFub3Yuc2VyaWFsaXphdGlvbi5kb21haW4ucHJvdG9zLlNpdGVGbGFnUGJSB 41 | WZsYWdzEhIKBG5hbWUYBiABKAlSBG5hbWUSIAoLZGVzY3JpcHRpb24YByABKAlSC2Rlc2NyaXB0aW9uEksKB2RvbWFpbnMYCCADK 42 | AsyMS5jb20ua29tYW5vdi5zZXJpYWxpemF0aW9uLmRvbWFpbi5wcm90b3MuRG9tYWluUGJSB2RvbWFpbnMSXAoPZGVmYXVsdE1ld 43 | GFUYWdzGAkgAygLMjIuY29tLmtvbWFub3Yuc2VyaWFsaXphdGlvbi5kb21haW4ucHJvdG9zLk1ldGFUYWdQYlIPZGVmYXVsdE1ld 44 | GFUYWdzEkUKBXBhZ2VzGAogAygLMi8uY29tLmtvbWFub3Yuc2VyaWFsaXphdGlvbi5kb21haW4ucHJvdG9zLlBhZ2VQYlIFcGFnZ 45 | XMSVwoLZW50cnlQb2ludHMYCyADKAsyNS5jb20ua29tYW5vdi5zZXJpYWxpemF0aW9uLmRvbWFpbi5wcm90b3MuRW50cnlQb2lud 46 | FBiUgtlbnRyeVBvaW50cxIcCglwdWJsaXNoZWQYDCABKAhSCXB1Ymxpc2hlZBIgCgtkYXRlQ3JlYXRlZBgNIAEoBFILZGF0ZUNyZ 47 | WF0ZWQSIAoLZGF0ZVVwZGF0ZWQYDiABKARSC2RhdGVVcGRhdGVkKkgKClNpdGVUeXBlUGISEwoPVW5rbm93blNpdGVUeXBlEAASC 48 | QoFRmxhc2gQARIPCgtTaWx2ZXJsaWdodBACEgkKBUh0bWw1EAMqOAoKU2l0ZUZsYWdQYhITCg9Vbmtub3duU2l0ZUZsYWcQABIIC 49 | gRGcmVlEAESCwoHUHJlbWl1bRACKlMKE1BhZ2VDb21wb25lbnRUeXBlUGISHAoYVW5rbm93blBhZ2VDb21wb25lbnRUeXBlEAASC 50 | AoEVGV4dBABEgoKBkJ1dHRvbhACEggKBEJsb2cQA2IGcHJvdG8z""" 51 | ).mkString)) 52 | com.google.protobuf.Descriptors.FileDescriptor.buildFrom(proto, Array( 53 | )) 54 | } 55 | } -------------------------------------------------------------------------------- /scala-serialization/src/main/scala/com/komanov/serialization/domain/protos/site/SiteTypePb.scala: -------------------------------------------------------------------------------- 1 | // Generated by the Scala Plugin for the Protocol Buffer Compiler. 2 | // Do not edit! 3 | // 4 | // Protofile syntax: PROTO3 5 | 6 | package com.komanov.serialization.domain.protos.site 7 | 8 | 9 | 10 | sealed trait SiteTypePb extends com.trueaccord.scalapb.GeneratedEnum { 11 | type EnumType = SiteTypePb 12 | def isUnknownSiteType: Boolean = false 13 | def isFlash: Boolean = false 14 | def isSilverlight: Boolean = false 15 | def isHtml5: Boolean = false 16 | def isUnrecognized: Boolean = false 17 | def companion: com.trueaccord.scalapb.GeneratedEnumCompanion[SiteTypePb] = SiteTypePb 18 | } 19 | 20 | object SiteTypePb extends com.trueaccord.scalapb.GeneratedEnumCompanion[SiteTypePb] { 21 | implicit def enumCompanion: com.trueaccord.scalapb.GeneratedEnumCompanion[SiteTypePb] = this 22 | @SerialVersionUID(0L) 23 | case object UnknownSiteType extends SiteTypePb { 24 | val value = 0 25 | val index = 0 26 | val name = "UnknownSiteType" 27 | override def isUnknownSiteType: Boolean = true 28 | } 29 | 30 | @SerialVersionUID(0L) 31 | case object Flash extends SiteTypePb { 32 | val value = 1 33 | val index = 1 34 | val name = "Flash" 35 | override def isFlash: Boolean = true 36 | } 37 | 38 | @SerialVersionUID(0L) 39 | case object Silverlight extends SiteTypePb { 40 | val value = 2 41 | val index = 2 42 | val name = "Silverlight" 43 | override def isSilverlight: Boolean = true 44 | } 45 | 46 | @SerialVersionUID(0L) 47 | case object Html5 extends SiteTypePb { 48 | val value = 3 49 | val index = 3 50 | val name = "Html5" 51 | override def isHtml5: Boolean = true 52 | } 53 | 54 | @SerialVersionUID(0L) 55 | case class Unrecognized(value: Int) extends SiteTypePb { 56 | val name = "UNRECOGNIZED" 57 | val index = -1 58 | override def isUnrecognized: Boolean = true 59 | } 60 | 61 | lazy val values = Seq(UnknownSiteType, Flash, Silverlight, Html5) 62 | def fromValue(value: Int): SiteTypePb = value match { 63 | case 0 => UnknownSiteType 64 | case 1 => Flash 65 | case 2 => Silverlight 66 | case 3 => Html5 67 | case __other => Unrecognized(__other) 68 | } 69 | def descriptor: com.google.protobuf.Descriptors.EnumDescriptor = SiteProto.descriptor.getEnumTypes.get(0) 70 | } -------------------------------------------------------------------------------- /scala-serialization/src/main/scala/com/komanov/serialization/domain/thriftscala/PageComponentTypePb.scala: -------------------------------------------------------------------------------- 1 | /** 2 | * Generated by Scrooge 3 | * version: 4.7.0 4 | * rev: d9d56174937f524a1981b38ebd6280eef7eeda4a 5 | * built at: 20160427-121531 6 | */ 7 | package com.komanov.serialization.domain.thriftscala 8 | 9 | import com.twitter.scrooge.ThriftEnum 10 | 11 | 12 | @javax.annotation.Generated(value = Array("com.twitter.scrooge.Compiler")) 13 | case object PageComponentTypePb { 14 | 15 | case object UnknownPageComponentType extends com.komanov.serialization.domain.thriftscala.PageComponentTypePb { 16 | val value: Int = 0 17 | val name: String = "UnknownPageComponentType" 18 | val originalName: String = "UnknownPageComponentType" 19 | } 20 | 21 | private[this] val _SomeUnknownPageComponentType = _root_.scala.Some(com.komanov.serialization.domain.thriftscala.PageComponentTypePb.UnknownPageComponentType) 22 | 23 | case object Text extends com.komanov.serialization.domain.thriftscala.PageComponentTypePb { 24 | val value: Int = 1 25 | val name: String = "Text" 26 | val originalName: String = "Text" 27 | } 28 | 29 | private[this] val _SomeText = _root_.scala.Some(com.komanov.serialization.domain.thriftscala.PageComponentTypePb.Text) 30 | 31 | case object Button extends com.komanov.serialization.domain.thriftscala.PageComponentTypePb { 32 | val value: Int = 2 33 | val name: String = "Button" 34 | val originalName: String = "Button" 35 | } 36 | 37 | private[this] val _SomeButton = _root_.scala.Some(com.komanov.serialization.domain.thriftscala.PageComponentTypePb.Button) 38 | 39 | case object Blog extends com.komanov.serialization.domain.thriftscala.PageComponentTypePb { 40 | val value: Int = 3 41 | val name: String = "Blog" 42 | val originalName: String = "Blog" 43 | } 44 | 45 | private[this] val _SomeBlog = _root_.scala.Some(com.komanov.serialization.domain.thriftscala.PageComponentTypePb.Blog) 46 | 47 | case class EnumUnknownPageComponentTypePb(value: Int) extends com.komanov.serialization.domain.thriftscala.PageComponentTypePb { 48 | val name: String = "EnumUnknownPageComponentTypePb" + value 49 | def originalName: String = name 50 | } 51 | 52 | /** 53 | * Find the enum by its integer value, as defined in the Thrift IDL. 54 | * @throws NoSuchElementException if the value is not found. 55 | */ 56 | def apply(value: Int): com.komanov.serialization.domain.thriftscala.PageComponentTypePb = 57 | value match { 58 | case 0 => com.komanov.serialization.domain.thriftscala.PageComponentTypePb.UnknownPageComponentType 59 | case 1 => com.komanov.serialization.domain.thriftscala.PageComponentTypePb.Text 60 | case 2 => com.komanov.serialization.domain.thriftscala.PageComponentTypePb.Button 61 | case 3 => com.komanov.serialization.domain.thriftscala.PageComponentTypePb.Blog 62 | case _ => throw new NoSuchElementException(value.toString) 63 | } 64 | 65 | /** 66 | * Find the enum by its integer value, as defined in the Thrift IDL. 67 | * returns an EnumUnknownPageComponentTypePb(value) if the value is not found. 68 | * In particular this allows ignoring new values added to an enum 69 | * in the IDL on the producer side when the consumer was not updated. 70 | */ 71 | def getOrUnknown(value: Int): com.komanov.serialization.domain.thriftscala.PageComponentTypePb = 72 | get(value) match { 73 | case _root_.scala.Some(e) => e 74 | case _root_.scala.None => EnumUnknownPageComponentTypePb(value) 75 | } 76 | 77 | /** 78 | * Find the enum by its integer value, as defined in the Thrift IDL. 79 | * Returns None if the value is not found 80 | */ 81 | def get(value: Int): _root_.scala.Option[com.komanov.serialization.domain.thriftscala.PageComponentTypePb] = 82 | value match { 83 | case 0 => _SomeUnknownPageComponentType 84 | case 1 => _SomeText 85 | case 2 => _SomeButton 86 | case 3 => _SomeBlog 87 | case _ => _root_.scala.None 88 | } 89 | 90 | def valueOf(name: String): _root_.scala.Option[com.komanov.serialization.domain.thriftscala.PageComponentTypePb] = 91 | name.toLowerCase match { 92 | case "unknownpagecomponenttype" => _SomeUnknownPageComponentType 93 | case "text" => _SomeText 94 | case "button" => _SomeButton 95 | case "blog" => _SomeBlog 96 | case _ => _root_.scala.None 97 | } 98 | 99 | lazy val list: List[com.komanov.serialization.domain.thriftscala.PageComponentTypePb] = scala.List[com.komanov.serialization.domain.thriftscala.PageComponentTypePb]( 100 | com.komanov.serialization.domain.thriftscala.PageComponentTypePb.UnknownPageComponentType, 101 | com.komanov.serialization.domain.thriftscala.PageComponentTypePb.Text, 102 | com.komanov.serialization.domain.thriftscala.PageComponentTypePb.Button, 103 | com.komanov.serialization.domain.thriftscala.PageComponentTypePb.Blog 104 | ) 105 | } 106 | 107 | 108 | 109 | @javax.annotation.Generated(value = Array("com.twitter.scrooge.Compiler")) 110 | sealed trait PageComponentTypePb extends ThriftEnum with Serializable -------------------------------------------------------------------------------- /scala-serialization/src/main/scala/com/komanov/serialization/domain/thriftscala/SiteFlagPb.scala: -------------------------------------------------------------------------------- 1 | /** 2 | * Generated by Scrooge 3 | * version: 4.7.0 4 | * rev: d9d56174937f524a1981b38ebd6280eef7eeda4a 5 | * built at: 20160427-121531 6 | */ 7 | package com.komanov.serialization.domain.thriftscala 8 | 9 | import com.twitter.scrooge.ThriftEnum 10 | 11 | 12 | @javax.annotation.Generated(value = Array("com.twitter.scrooge.Compiler")) 13 | case object SiteFlagPb { 14 | 15 | case object UnknownSiteFlag extends com.komanov.serialization.domain.thriftscala.SiteFlagPb { 16 | val value: Int = 0 17 | val name: String = "UnknownSiteFlag" 18 | val originalName: String = "UnknownSiteFlag" 19 | } 20 | 21 | private[this] val _SomeUnknownSiteFlag = _root_.scala.Some(com.komanov.serialization.domain.thriftscala.SiteFlagPb.UnknownSiteFlag) 22 | 23 | case object Free extends com.komanov.serialization.domain.thriftscala.SiteFlagPb { 24 | val value: Int = 1 25 | val name: String = "Free" 26 | val originalName: String = "Free" 27 | } 28 | 29 | private[this] val _SomeFree = _root_.scala.Some(com.komanov.serialization.domain.thriftscala.SiteFlagPb.Free) 30 | 31 | case object Premium extends com.komanov.serialization.domain.thriftscala.SiteFlagPb { 32 | val value: Int = 2 33 | val name: String = "Premium" 34 | val originalName: String = "Premium" 35 | } 36 | 37 | private[this] val _SomePremium = _root_.scala.Some(com.komanov.serialization.domain.thriftscala.SiteFlagPb.Premium) 38 | 39 | case class EnumUnknownSiteFlagPb(value: Int) extends com.komanov.serialization.domain.thriftscala.SiteFlagPb { 40 | val name: String = "EnumUnknownSiteFlagPb" + value 41 | def originalName: String = name 42 | } 43 | 44 | /** 45 | * Find the enum by its integer value, as defined in the Thrift IDL. 46 | * @throws NoSuchElementException if the value is not found. 47 | */ 48 | def apply(value: Int): com.komanov.serialization.domain.thriftscala.SiteFlagPb = 49 | value match { 50 | case 0 => com.komanov.serialization.domain.thriftscala.SiteFlagPb.UnknownSiteFlag 51 | case 1 => com.komanov.serialization.domain.thriftscala.SiteFlagPb.Free 52 | case 2 => com.komanov.serialization.domain.thriftscala.SiteFlagPb.Premium 53 | case _ => throw new NoSuchElementException(value.toString) 54 | } 55 | 56 | /** 57 | * Find the enum by its integer value, as defined in the Thrift IDL. 58 | * returns an EnumUnknownSiteFlagPb(value) if the value is not found. 59 | * In particular this allows ignoring new values added to an enum 60 | * in the IDL on the producer side when the consumer was not updated. 61 | */ 62 | def getOrUnknown(value: Int): com.komanov.serialization.domain.thriftscala.SiteFlagPb = 63 | get(value) match { 64 | case _root_.scala.Some(e) => e 65 | case _root_.scala.None => EnumUnknownSiteFlagPb(value) 66 | } 67 | 68 | /** 69 | * Find the enum by its integer value, as defined in the Thrift IDL. 70 | * Returns None if the value is not found 71 | */ 72 | def get(value: Int): _root_.scala.Option[com.komanov.serialization.domain.thriftscala.SiteFlagPb] = 73 | value match { 74 | case 0 => _SomeUnknownSiteFlag 75 | case 1 => _SomeFree 76 | case 2 => _SomePremium 77 | case _ => _root_.scala.None 78 | } 79 | 80 | def valueOf(name: String): _root_.scala.Option[com.komanov.serialization.domain.thriftscala.SiteFlagPb] = 81 | name.toLowerCase match { 82 | case "unknownsiteflag" => _SomeUnknownSiteFlag 83 | case "free" => _SomeFree 84 | case "premium" => _SomePremium 85 | case _ => _root_.scala.None 86 | } 87 | 88 | lazy val list: List[com.komanov.serialization.domain.thriftscala.SiteFlagPb] = scala.List[com.komanov.serialization.domain.thriftscala.SiteFlagPb]( 89 | com.komanov.serialization.domain.thriftscala.SiteFlagPb.UnknownSiteFlag, 90 | com.komanov.serialization.domain.thriftscala.SiteFlagPb.Free, 91 | com.komanov.serialization.domain.thriftscala.SiteFlagPb.Premium 92 | ) 93 | } 94 | 95 | 96 | 97 | @javax.annotation.Generated(value = Array("com.twitter.scrooge.Compiler")) 98 | sealed trait SiteFlagPb extends ThriftEnum with Serializable -------------------------------------------------------------------------------- /scala-serialization/src/main/scala/com/komanov/serialization/domain/thriftscala/SiteTypePb.scala: -------------------------------------------------------------------------------- 1 | /** 2 | * Generated by Scrooge 3 | * version: 4.7.0 4 | * rev: d9d56174937f524a1981b38ebd6280eef7eeda4a 5 | * built at: 20160427-121531 6 | */ 7 | package com.komanov.serialization.domain.thriftscala 8 | 9 | import com.twitter.scrooge.ThriftEnum 10 | 11 | 12 | @javax.annotation.Generated(value = Array("com.twitter.scrooge.Compiler")) 13 | case object SiteTypePb { 14 | 15 | case object UnknownSiteType extends com.komanov.serialization.domain.thriftscala.SiteTypePb { 16 | val value: Int = 0 17 | val name: String = "UnknownSiteType" 18 | val originalName: String = "UnknownSiteType" 19 | } 20 | 21 | private[this] val _SomeUnknownSiteType = _root_.scala.Some(com.komanov.serialization.domain.thriftscala.SiteTypePb.UnknownSiteType) 22 | 23 | case object Flash extends com.komanov.serialization.domain.thriftscala.SiteTypePb { 24 | val value: Int = 1 25 | val name: String = "Flash" 26 | val originalName: String = "Flash" 27 | } 28 | 29 | private[this] val _SomeFlash = _root_.scala.Some(com.komanov.serialization.domain.thriftscala.SiteTypePb.Flash) 30 | 31 | case object Silverlight extends com.komanov.serialization.domain.thriftscala.SiteTypePb { 32 | val value: Int = 2 33 | val name: String = "Silverlight" 34 | val originalName: String = "Silverlight" 35 | } 36 | 37 | private[this] val _SomeSilverlight = _root_.scala.Some(com.komanov.serialization.domain.thriftscala.SiteTypePb.Silverlight) 38 | 39 | case object Html5 extends com.komanov.serialization.domain.thriftscala.SiteTypePb { 40 | val value: Int = 3 41 | val name: String = "Html5" 42 | val originalName: String = "Html5" 43 | } 44 | 45 | private[this] val _SomeHtml5 = _root_.scala.Some(com.komanov.serialization.domain.thriftscala.SiteTypePb.Html5) 46 | 47 | case class EnumUnknownSiteTypePb(value: Int) extends com.komanov.serialization.domain.thriftscala.SiteTypePb { 48 | val name: String = "EnumUnknownSiteTypePb" + value 49 | def originalName: String = name 50 | } 51 | 52 | /** 53 | * Find the enum by its integer value, as defined in the Thrift IDL. 54 | * @throws NoSuchElementException if the value is not found. 55 | */ 56 | def apply(value: Int): com.komanov.serialization.domain.thriftscala.SiteTypePb = 57 | value match { 58 | case 0 => com.komanov.serialization.domain.thriftscala.SiteTypePb.UnknownSiteType 59 | case 1 => com.komanov.serialization.domain.thriftscala.SiteTypePb.Flash 60 | case 2 => com.komanov.serialization.domain.thriftscala.SiteTypePb.Silverlight 61 | case 3 => com.komanov.serialization.domain.thriftscala.SiteTypePb.Html5 62 | case _ => throw new NoSuchElementException(value.toString) 63 | } 64 | 65 | /** 66 | * Find the enum by its integer value, as defined in the Thrift IDL. 67 | * returns an EnumUnknownSiteTypePb(value) if the value is not found. 68 | * In particular this allows ignoring new values added to an enum 69 | * in the IDL on the producer side when the consumer was not updated. 70 | */ 71 | def getOrUnknown(value: Int): com.komanov.serialization.domain.thriftscala.SiteTypePb = 72 | get(value) match { 73 | case _root_.scala.Some(e) => e 74 | case _root_.scala.None => EnumUnknownSiteTypePb(value) 75 | } 76 | 77 | /** 78 | * Find the enum by its integer value, as defined in the Thrift IDL. 79 | * Returns None if the value is not found 80 | */ 81 | def get(value: Int): _root_.scala.Option[com.komanov.serialization.domain.thriftscala.SiteTypePb] = 82 | value match { 83 | case 0 => _SomeUnknownSiteType 84 | case 1 => _SomeFlash 85 | case 2 => _SomeSilverlight 86 | case 3 => _SomeHtml5 87 | case _ => _root_.scala.None 88 | } 89 | 90 | def valueOf(name: String): _root_.scala.Option[com.komanov.serialization.domain.thriftscala.SiteTypePb] = 91 | name.toLowerCase match { 92 | case "unknownsitetype" => _SomeUnknownSiteType 93 | case "flash" => _SomeFlash 94 | case "silverlight" => _SomeSilverlight 95 | case "html5" => _SomeHtml5 96 | case _ => _root_.scala.None 97 | } 98 | 99 | lazy val list: List[com.komanov.serialization.domain.thriftscala.SiteTypePb] = scala.List[com.komanov.serialization.domain.thriftscala.SiteTypePb]( 100 | com.komanov.serialization.domain.thriftscala.SiteTypePb.UnknownSiteType, 101 | com.komanov.serialization.domain.thriftscala.SiteTypePb.Flash, 102 | com.komanov.serialization.domain.thriftscala.SiteTypePb.Silverlight, 103 | com.komanov.serialization.domain.thriftscala.SiteTypePb.Html5 104 | ) 105 | } 106 | 107 | 108 | 109 | @javax.annotation.Generated(value = Array("com.twitter.scrooge.Compiler")) 110 | sealed trait SiteTypePb extends ThriftEnum with Serializable -------------------------------------------------------------------------------- /scala-serialization/src/test/scala/com/komanov/serialization/converters/BasePerfTest.scala: -------------------------------------------------------------------------------- 1 | package com.komanov.serialization.converters 2 | 3 | import com.komanov.serialization.domain.{EventProcessor, Site, SiteEvent} 4 | 5 | trait BasePerfTest[Input, Output] { 6 | 7 | val N = 100000 8 | 9 | def createInput(converter: MyConverter, site: Site): Input 10 | 11 | def convert(converter: MyConverter, input: Input): Output 12 | 13 | def doTest(): Unit = { 14 | println("Warming up...") 15 | doWarmUp() 16 | 17 | println("Testing!") 18 | 19 | println("Converter," + TestData.sites.map(_._1).mkString(",")) 20 | 21 | for ((converterName, converter) <- Converters.all) { 22 | val results = for { 23 | (name, site) <- TestData.sites 24 | input = createInput(converter, site) 25 | } yield doTest(converter, input) 26 | 27 | println(converterName + "," + results.map(_._2).mkString(",")) 28 | } 29 | } 30 | 31 | private def doTest(c: MyConverter, input: Input): (Long, Long) = { 32 | Runtime.getRuntime.gc() 33 | Runtime.getRuntime.runFinalization() 34 | Runtime.getRuntime.gc() 35 | Runtime.getRuntime.gc() 36 | 37 | val start = System.nanoTime() 38 | runXTimes(c, input, N) 39 | val duration = System.nanoTime() - start 40 | val avg = duration / N 41 | duration -> avg 42 | } 43 | 44 | private def runXTimes(c: MyConverter, input: Input, x: Int): Unit = { 45 | for (_ <- 0 until x) { 46 | convert(c, input) 47 | } 48 | } 49 | 50 | private def doWarmUp() = { 51 | val x = N / 10 52 | 53 | for ((converterName, c) <- Converters.all) { 54 | print(s"$converterName... ") 55 | for (data <- TestData.sites) { 56 | val input = createInput(c, data._2) 57 | runXTimes(c, input, x) 58 | } 59 | println("done") 60 | } 61 | } 62 | 63 | } 64 | 65 | /* 66 | Converter,1k,2k,4k,8k,64k 67 | JSON,4365,8437,16771,35164,270175 68 | ScalaPB,2176,3936,7475,14822,133119 69 | Java PB,3173,6393,10123,21379,209716 70 | Java Thrift,3657,6805,13074,27667,261673 71 | Scrooge,3572,6506,12050,25036,233895 72 | Serializable,13156,21203,36457,79045,652942 73 | Pickles,53991,83601,220440,589888,4162785 74 | Boopickle,5451,10628,17533,29765,225717 75 | Chill,7202,9783,15130,27338,207871 76 | */ 77 | object SiteSerializationPerfTestApp extends App with BasePerfTest[Site, Array[Byte]] { 78 | override def createInput(converter: MyConverter, site: Site): Site = site 79 | 80 | override def convert(converter: MyConverter, input: Site): Array[Byte] = converter.toByteArray(input) 81 | 82 | doTest() 83 | } 84 | 85 | /* 86 | Converter,1k,2k,4k,8k,64k 87 | JSON,7670,12964,24804,51578,384623 88 | ScalaPB,2335,4576,7326,14754,128730 89 | Java PB,3504,6076,10269,19792,168952 90 | Java Thrift,3451,5812,10048,20693,176020 91 | Scrooge,3640,6522,12740,25081,230556 92 | Serializable,61455,84196,102870,126839,575232 93 | Pickles,40337,63840,165109,446043,3201348 94 | Boopickle,2848,5017,8454,15962,97270 95 | Chill,6675,9654,14770,25261,193136 96 | */ 97 | object SiteDeserializationPerfTestApp extends App with BasePerfTest[Array[Byte], Site] { 98 | override def createInput(converter: MyConverter, site: Site): Array[Byte] = converter.toByteArray(site) 99 | 100 | override def convert(converter: MyConverter, input: Array[Byte]): Site = converter.fromByteArray(input) 101 | 102 | doTest() 103 | } 104 | 105 | /* 106 | Converter,1k,2k,4k,8k,64k 107 | JSON,9192,17366,34574,76571,701055 108 | ScalaPB,2194,4542,8618,17011,170413 109 | Java PB,3110,6390,11922,25144,283493 110 | Java Thrift,4357,9180,17560,37924,405784 111 | Scrooge,4842,10226,19922,42428,423060 112 | Serializable,16957,31195,68399,160541,1492595 113 | Pickles,47793,83754,236829,648561,4936980 114 | Boopickle,16867,32278,62663,135614,1379687 115 | Chill,3704,7098,15025,33376,326856 116 | */ 117 | object EventsSerializationPerfTestApp extends App with BasePerfTest[Seq[SiteEvent], Unit] { 118 | override def createInput(converter: MyConverter, site: Site): Seq[SiteEvent] = { 119 | EventProcessor.unapply(site).map(_.event) 120 | } 121 | 122 | override def convert(converter: MyConverter, input: Seq[SiteEvent]): Unit = { 123 | for (e <- input) { 124 | converter.toByteArray(e) 125 | } 126 | } 127 | 128 | doTest() 129 | } 130 | 131 | /* 132 | Converter,1k,2k,4k,8k,64k 133 | JSON,12125,23012,45171,98008,880806 134 | ScalaPB,3394,6644,12681,26589,251012 135 | Java PB,2690,5550,10564,20359,214071 136 | Java Thrift,3556,6974,13436,29135,281339 137 | Scrooge,3911,7678,15867,33832,331989 138 | Serializable,78081,138535,323729,774177,6725015 139 | Pickles,34623,61638,169895,462075,3522794 140 | Boopickle,4828,9941,18158,38296,389896 141 | Chill,4770,9203,18638,38146,382506 142 | */ 143 | object EventsDeserializationPerfTestApp extends App with BasePerfTest[Seq[(Class[_], Array[Byte])], Unit] { 144 | override def createInput(converter: MyConverter, site: Site): Seq[(Class[_], Array[Byte])] = { 145 | EventProcessor.unapply(site).map(_.event).map(e => e.getClass -> converter.toByteArray(e)) 146 | } 147 | 148 | override def convert(converter: MyConverter, input: Seq[(Class[_], Array[Byte])]): Unit = { 149 | for ((clazz, bytes) <- input) { 150 | converter.siteEventFromByteArray(clazz, bytes) 151 | } 152 | } 153 | 154 | doTest() 155 | } 156 | -------------------------------------------------------------------------------- /scala-serialization/src/test/scala/com/komanov/serialization/converters/ConversionsUtilsTest.scala: -------------------------------------------------------------------------------- 1 | package com.komanov.serialization.converters 2 | 3 | import java.time.Instant 4 | import java.util.UUID 5 | 6 | import org.specs2.mutable.SpecificationWithJUnit 7 | import org.specs2.specification.Scope 8 | 9 | class ConversionsUtilsTest extends SpecificationWithJUnit { 10 | 11 | "UUID" should { 12 | "be serialized-parsed" in new ctx { 13 | val zero = new UUID(0, 0) 14 | val rnd = UUID.randomUUID() 15 | ConversionUtils.bytesToUuid(ConversionUtils.uuidToBytes(null)) must beNull 16 | ConversionUtils.bytesToUuid(ConversionUtils.uuidToBytes(zero)) must be_===(zero) 17 | ConversionUtils.bytesToUuid(ConversionUtils.uuidToBytes(rnd)) must be_===(rnd) 18 | 19 | ConversionUtils.bytesToUuid(ConversionUtils.uuidToByteBuffer(null)) must beNull 20 | ConversionUtils.bytesToUuid(ConversionUtils.uuidToByteBuffer(zero)) must be_===(zero) 21 | ConversionUtils.bytesToUuid(ConversionUtils.uuidToByteBuffer(rnd)) must be_===(rnd) 22 | } 23 | } 24 | 25 | "Instant" should { 26 | "be serialized-parsed" in new ctx { 27 | val zero = Instant.ofEpochMilli(0) 28 | val now = Instant.now() 29 | ConversionUtils.longToInstance(ConversionUtils.instantToLong(zero)) must be_===(zero) 30 | ConversionUtils.longToInstance(ConversionUtils.instantToLong(now)) must be_===(now) 31 | } 32 | } 33 | 34 | class ctx extends Scope { 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /scala-serialization/src/test/scala/com/komanov/serialization/converters/Converters.scala: -------------------------------------------------------------------------------- 1 | package com.komanov.serialization.converters 2 | 3 | object Converters { 4 | 5 | val all: Seq[(String, MyConverter)] = Seq( 6 | "JSON" -> JsonConverter, 7 | "ScalaPB" -> ScalaPbConverter, 8 | "Java PB" -> JavaPbConverter, 9 | "Java Thrift" -> JavaThriftConverter, 10 | "Scrooge" -> ScroogeConverter, 11 | "Serializable" -> JavaSerializationConverter, 12 | "Pickling" -> PicklingConverter, 13 | "BooPickle" -> BoopickleConverter, 14 | "Chill" -> ChillConverter 15 | ) 16 | 17 | } 18 | -------------------------------------------------------------------------------- /scala-serialization/src/test/scala/com/komanov/serialization/converters/EventsReportGenerator.scala: -------------------------------------------------------------------------------- 1 | package com.komanov.serialization.converters 2 | 3 | import java.io.{ByteArrayOutputStream, File} 4 | import java.nio.file.{Files, StandardOpenOption} 5 | import java.util.zip.GZIPOutputStream 6 | 7 | import com.komanov.serialization.converters.IoUtils._ 8 | 9 | /* 10 | Data Sizes (raw) 11 | Converter,1k,ev 1k,2k,ev 2k,4k,ev 4k,8k,ev 8k,64k,ev 64k 12 | JSON,1060,1277,2076,2499,4043,5119,8173,10961,65835,109539 13 | Protobuf,554,578,1175,1192,1930,2076,3058,3604,27111,42455 14 | Thrift,712,700,1441,1430,2499,2639,4315,4911,38289,57029 15 | Serializable,2207,2716,3311,5078,4549,11538,6615,26228,43168,240267 16 | Pickling,1681,1565,2989,3023,6000,6284,13034,13462,106901,128797 17 | Boopickle,544,593,1130,1220,1855,2117,2882,3655,16290,42150 18 | Chill,908,588,1695,1260,2507,2397,3644,3981,26259,47048 19 | Data Sizes (gzip) 20 | Converter,1k,ev 1k,2k,ev 2k,4k,ev 4k,8k,ev 8k,64k,ev 64k 21 | JSON,682,1366,1137,2565,1630,5251,2677,11784,11719,116024 22 | Protobuf,488,775,898,1463,1334,2710,2175,5552,9394,62763 23 | Thrift,541,876,966,1669,1400,3189,2256,6673,9599,75044 24 | Serializable,1185,2505,1738,4621,2221,9975,3046,23279,10356,216106 25 | Pickling,692,1613,1145,2973,1621,5999,2577,13496,11057,130714 26 | Boopickle,471,790,861,1492,1272,2748,2078,5600,9046,62455 27 | Chill,599,795,1022,1544,1452,3073,2279,6075,9219,68228 28 | Data Sizes 29 | Converter,1k,ev 1k,2k,ev 2k,4k,ev 4k,8k,ev 8k,64k,ev 64k 30 | JSON (rw),1060,1277,2076,2499,4043,5119,8173,10961,65835,109539 31 | JSON (gz),682,1366,1137,2565,1630,5251,2677,11784,11719,116024 32 | Protobuf (rw),554,578,1175,1192,1930,2076,3058,3604,27111,42455 33 | Protobuf (gz),488,775,898,1463,1334,2710,2175,5552,9394,62763 34 | Thrift (rw),712,700,1441,1430,2499,2639,4315,4911,38289,57029 35 | Thrift (gz),541,876,966,1669,1400,3189,2256,6673,9599,75044 36 | Serializable (rw),2207,2716,3311,5078,4549,11538,6615,26228,43168,240267 37 | Serializable (gz),1185,2505,1738,4621,2221,9975,3046,23279,10356,216106 38 | Pickling (rw),1681,1565,2989,3023,6000,6284,13034,13462,106901,128797 39 | Pickling (gz),692,1613,1145,2973,1621,5999,2577,13496,11057,130714 40 | Boopickle (rw),544,593,1130,1220,1855,2117,2882,3655,16290,42150 41 | Boopickle (gz),471,790,861,1492,1272,2748,2078,5600,9046,62455 42 | Chill (rw),908,588,1695,1260,2507,2397,3644,3981,26259,47048 43 | Chill (gz),599,795,1022,1544,1452,3073,2279,6075,9219,68228 44 | */ 45 | object EventsReportGenerator extends App { 46 | 47 | val flush = false 48 | 49 | val dir = new File(new File(System.getProperty("user.home"), "123"), "events") 50 | require(!flush || dir.exists() || dir.mkdirs()) 51 | 52 | val (raws, gzips, both) = (Seq.newBuilder[(String, Seq[Int])], Seq.newBuilder[(String, Seq[Int])], Seq.newBuilder[(String, Seq[Int])]) 53 | 54 | for ((converterName, converter) <- Converters.all if converter ne ScroogeConverter if converter ne ScalaPbConverter) { 55 | val results = Seq.newBuilder[(Int, Int)] 56 | for ((name, site, events) <- TestData.all) { 57 | val bytes = converter.toByteArray(site) 58 | val gzipLen = getGzipByteLength(bytes) 59 | 60 | val eventsAndBytes = events.map(e => e -> converter.toByteArray(e.event)) 61 | val eventsLen = eventsAndBytes.map(_._2.length).sum 62 | val eventsGzipLen = eventsAndBytes.map(_._2).map(getGzipByteLength).sum 63 | 64 | results += bytes.length -> gzipLen 65 | results += eventsLen -> eventsGzipLen 66 | 67 | if (flush) { 68 | val normalizedConverterName = converterName.toLowerCase().replace(" ", "-") 69 | Files.write(dir.getParentFile.toPath.resolve(s"site_${name}_$normalizedConverterName.bin"), bytes, StandardOpenOption.CREATE) 70 | for ((event, eventBytes) <- eventsAndBytes) { 71 | Files.write(dir.toPath.resolve(s"${name}_${normalizedConverterName}_${event.event.getClass.getSimpleName}.bin"), eventBytes, StandardOpenOption.CREATE) 72 | } 73 | } 74 | } 75 | 76 | raws += converterName -> results.result().map(_._1) 77 | gzips += converterName -> results.result().map(_._2) 78 | both += (converterName + " (rw)") -> results.result().map(_._1) 79 | both += (converterName + " (gz)") -> results.result().map(_._2) 80 | } 81 | 82 | println("Data Sizes (raw)") 83 | printHeaders 84 | printSizes(raws.result()) 85 | 86 | println("Data Sizes (gzip)") 87 | printHeaders 88 | printSizes(gzips.result()) 89 | 90 | println("Data Sizes") 91 | printHeaders 92 | printSizes(both.result()) 93 | 94 | private def printHeaders: Any = { 95 | println("Converter," + TestData.sites.flatMap(t => Seq(t._1, "ev " + t._1)).mkString(",")) 96 | } 97 | 98 | private def printSizes(all: Seq[(String, Seq[Int])]): Unit = { 99 | for ((name, list) <- all) { 100 | println(name + "," + list.mkString(",")) 101 | } 102 | } 103 | 104 | private def getGzipByteLength(bytes: Array[Byte]): Int = { 105 | using(new ByteArrayOutputStream()) { baos => 106 | using(new GZIPOutputStream(baos)) { os => 107 | os.write(bytes) 108 | } 109 | baos.toByteArray.length 110 | } 111 | } 112 | 113 | } 114 | -------------------------------------------------------------------------------- /scala-serialization/src/test/scala/com/komanov/serialization/converters/ReportGenerator.scala: -------------------------------------------------------------------------------- 1 | package com.komanov.serialization.converters 2 | 3 | import java.io.{ByteArrayOutputStream, File} 4 | import java.nio.file.{Files, StandardOpenOption} 5 | import java.util.zip.GZIPOutputStream 6 | 7 | import com.komanov.serialization.converters.IoUtils._ 8 | 9 | /* 10 | Data Sizes (raw) 11 | Converter,1k,2k,4k,8k,64k 12 | JSON,1060,2076,4043,8173,65835 13 | Protobuf,554,1175,1930,3058,27111 14 | Thrift,712,1441,2499,4315,38289 15 | Serializable,2207,3311,4549,6615,43168 16 | Pickling,1681,2989,6000,13034,106901 17 | Boopickle,544,1130,1855,2882,16290 18 | Chill,908,1695,2507,3643,26261 19 | Data Sizes (gzip) 20 | Converter,1k,2k,4k,8k,64k 21 | JSON,683,1136,1629,2681,11697 22 | Protobuf,486,893,1329,2177,9391 23 | Thrift,541,963,1400,2251,9612 24 | Serializable,1186,1740,2223,3044,10366 25 | Pickling,692,1144,1619,2579,11039 26 | Boopickle,468,858,1271,2076,9044 27 | Chill,601,1025,1455,2274,9193 28 | */ 29 | object ReportGenerator extends App { 30 | 31 | val flush = true 32 | 33 | val dir = new File(System.getProperty("user.home"), "123") 34 | require(!flush || dir.exists() || dir.mkdirs()) 35 | 36 | val (raws, gzips) = (Seq.newBuilder[(String, Seq[Int])], Seq.newBuilder[(String, Seq[Int])]) 37 | 38 | for ((converterName, converter) <- Converters.all if converter ne ScalaPbConverter if converter ne ScroogeConverter) { 39 | val results = Seq.newBuilder[(Int, Int)] 40 | for ((name, site) <- TestData.sites) { 41 | val bytes = converter.toByteArray(site) 42 | val gzipLen = getGzipByteLength(bytes) 43 | 44 | results += bytes.length -> gzipLen 45 | 46 | if (flush) { 47 | val normalizedConverterName = converterName.toLowerCase().replace(" ", "-") 48 | Files.write(dir.toPath.resolve(s"site_${name}_$normalizedConverterName.bin"), bytes, StandardOpenOption.CREATE) 49 | } 50 | } 51 | 52 | raws += converterName -> results.result().map(_._1) 53 | gzips += converterName -> results.result().map(_._2) 54 | } 55 | 56 | println("Data Sizes (raw)") 57 | printHeaders 58 | printSizes(raws.result()) 59 | 60 | println("Data Sizes (gzip)") 61 | printHeaders 62 | printSizes(gzips.result()) 63 | 64 | private def printHeaders: Any = { 65 | println("Converter," + TestData.sites.map(_._1).mkString(",")) 66 | } 67 | 68 | private def printSizes(all: Seq[(String, Seq[Int])]): Unit = { 69 | for ((name, list) <- all) { 70 | println(name + "," + list.mkString(",")) 71 | } 72 | } 73 | 74 | private def getGzipByteLength(bytes: Array[Byte]): Int = { 75 | using(new ByteArrayOutputStream()) { baos => 76 | using(new GZIPOutputStream(baos)) { os => 77 | os.write(bytes) 78 | } 79 | baos.toByteArray.length 80 | } 81 | } 82 | 83 | } 84 | -------------------------------------------------------------------------------- /scala-serialization/src/test/scala/com/komanov/serialization/converters/SerializationTest.scala: -------------------------------------------------------------------------------- 1 | package com.komanov.serialization.converters 2 | 3 | import java.io.ByteArrayOutputStream 4 | 5 | import com.komanov.serialization.domain.SiteEventData 6 | import org.apache.commons.io.HexDump 7 | import org.specs2.mutable.SpecificationWithJUnit 8 | import org.specs2.specification.Scope 9 | import org.specs2.specification.core.Fragments 10 | 11 | class SerializationTest extends SpecificationWithJUnit { 12 | 13 | sequential 14 | 15 | doTest("JSON", JsonConverter) 16 | doTest("ScalaPB", ScalaPbConverter) 17 | doTest("Java Protobuf", JavaPbConverter) 18 | doTest("Java Thrift", JavaThriftConverter) 19 | doTest("Scrooge", ScroogeConverter) 20 | doTest("Serializable", JavaSerializationConverter) 21 | doTest("Pickling", PicklingConverter) 22 | doTest("BooPickle", BoopickleConverter) 23 | doTest("Chill", ChillConverter) 24 | 25 | "ScalaPB and Java Protobuf" should { 26 | Fragments.foreach(TestData.sites) { case (name, site) => 27 | s"be interoperable for site of $name" in new ctx { 28 | val javaMessage = JavaPbConverter.toByteArray(site) 29 | val scalaMessage = ScalaPbConverter.toByteArray(site) 30 | toHexDump(javaMessage) must be_===(toHexDump(scalaMessage)) 31 | } 32 | } 33 | 34 | Fragments.foreach(TestData.events) { case (name, events) => 35 | s"be interoperable events of $name" in new ctx { 36 | for (SiteEventData(_, event, _) <- events) { 37 | val javaMessage = JavaPbConverter.toByteArray(event) 38 | val scalaMessage = ScalaPbConverter.toByteArray(event) 39 | toHexDump(javaMessage) must be_===(toHexDump(scalaMessage)) 40 | } 41 | } 42 | } 43 | } 44 | 45 | "Scrooge and Java Thrift" should { 46 | Fragments.foreach(TestData.sites) { case (name, site) => 47 | s"be interoperable for site of $name" in new ctx { 48 | val javaMessage = JavaThriftConverter.toByteArray(site) 49 | val scalaMessage = ScroogeConverter.toByteArray(site) 50 | toHexDump(javaMessage) must be_===(toHexDump(scalaMessage)) 51 | } 52 | } 53 | 54 | Fragments.foreach(TestData.events) { case (name, events) => 55 | s"be interoperable events of $name" in new ctx { 56 | for (SiteEventData(_, event, _) <- events) { 57 | val javaMessage = JavaThriftConverter.toByteArray(event) 58 | val scalaMessage = ScroogeConverter.toByteArray(event) 59 | toHexDump(javaMessage) must be_===(toHexDump(scalaMessage)) 60 | } 61 | } 62 | } 63 | } 64 | 65 | class ctx extends Scope 66 | 67 | def toHexDump(arr: Array[Byte]): String = { 68 | if (arr.isEmpty) { 69 | "" 70 | } else { 71 | val baos = new ByteArrayOutputStream 72 | HexDump.dump(arr, 0, baos, 0) 73 | new String(baos.toByteArray) 74 | } 75 | } 76 | 77 | def doTest(converterName: String, converter: MyConverter) = { 78 | converterName should { 79 | Fragments.foreach(TestData.sites) { case (name, site) => 80 | s"serialize-parse site of $name" in new ctx { 81 | val bytes = converter.toByteArray(site) 82 | val parsed = converter.fromByteArray(bytes) 83 | parsed must be_===(site) 84 | } 85 | } 86 | 87 | Fragments.foreach(TestData.events) { case (name, events) => 88 | s"serialize-parse site events of $name" in new ctx { 89 | for (SiteEventData(_, event, _) <- events) { 90 | val bytes = converter.toByteArray(event) 91 | val parsed = converter.siteEventFromByteArray(event.getClass, bytes) 92 | parsed must be_===(event) 93 | } 94 | } 95 | } 96 | } 97 | } 98 | 99 | } 100 | -------------------------------------------------------------------------------- /scala-serialization/src/test/scala/com/komanov/serialization/domain/EventProcessorTest.scala: -------------------------------------------------------------------------------- 1 | package com.komanov.serialization.domain 2 | 3 | import com.komanov.serialization.converters.TestData 4 | import org.specs2.mutable.SpecificationWithJUnit 5 | import org.specs2.specification.core.Fragments 6 | 7 | class EventProcessorTest extends SpecificationWithJUnit { 8 | 9 | "apply/unapply" should { 10 | Fragments.foreach(TestData.sites) { case (name, site) => 11 | s"serialize and deserialize a site [$name]" in { 12 | val parsed = EventProcessor.apply(EventProcessor.unapply(site)) 13 | parsed must be_===(site) 14 | } 15 | } 16 | } 17 | 18 | } 19 | --------------------------------------------------------------------------------