@@ -11,11 +11,13 @@ import kotlinx.serialization.cbor.*
11
11
import kotlinx.serialization.descriptors.*
12
12
import kotlinx.serialization.encoding.*
13
13
14
+ internal interface CborSerializer
15
+
14
16
/* *
15
17
* Serializer object providing [SerializationStrategy] and [DeserializationStrategy] for [CborElement].
16
18
* It can only be used by with [Cbor] format and its input ([CborDecoder] and [CborEncoder]).
17
19
*/
18
- internal object CborElementSerializer : KSerializer<CborElement> {
20
+ internal object CborElementSerializer : KSerializer<CborElement>, CborSerializer {
19
21
override val descriptor: SerialDescriptor =
20
22
buildSerialDescriptor(" kotlinx.serialization.cbor.CborElement" , PolymorphicKind .SEALED ) {
21
23
// Resolve cyclic dependency in descriptors by late binding
@@ -52,7 +54,7 @@ internal object CborElementSerializer : KSerializer<CborElement> {
52
54
* Serializer object providing [SerializationStrategy] and [DeserializationStrategy] for [CborPrimitive].
53
55
* It can only be used by with [Cbor] format an its input ([CborDecoder] and [CborEncoder]).
54
56
*/
55
- internal object CborPrimitiveSerializer : KSerializer<CborPrimitive<*>> {
57
+ internal object CborPrimitiveSerializer : KSerializer<CborPrimitive<*>>, CborSerializer {
56
58
override val descriptor: SerialDescriptor =
57
59
buildSerialDescriptor(" kotlinx.serialization.cbor.CborPrimitive" , PolymorphicKind .SEALED )
58
60
@@ -79,7 +81,7 @@ internal object CborPrimitiveSerializer : KSerializer<CborPrimitive<*>> {
79
81
* Serializer object providing [SerializationStrategy] and [DeserializationStrategy] for [CborNull].
80
82
* It can only be used by with [Cbor] format an its input ([CborDecoder] and [CborEncoder]).
81
83
*/
82
- internal object CborNullSerializer : KSerializer<CborNull> {
84
+ internal object CborNullSerializer : KSerializer<CborNull>, CborSerializer {
83
85
84
86
override val descriptor: SerialDescriptor =
85
87
buildSerialDescriptor(" kotlinx.serialization.cbor.CborNull" , SerialKind .ENUM )
@@ -102,7 +104,7 @@ internal object CborNullSerializer : KSerializer<CborNull> {
102
104
}
103
105
104
106
105
- internal object CborIntSerializer : KSerializer<CborInt<*>> {
107
+ internal object CborIntSerializer : KSerializer<CborInt<*>>, CborSerializer {
106
108
override val descriptor: SerialDescriptor =
107
109
PrimitiveSerialDescriptor (" kotlinx.serialization.cbor.CborInt" , PrimitiveKind .LONG )
108
110
@@ -120,7 +122,7 @@ internal object CborIntSerializer : KSerializer<CborInt<*>> {
120
122
}
121
123
}
122
124
123
- internal object CborNegativeIntSerializer : KSerializer<CborNegativeInt> {
125
+ internal object CborNegativeIntSerializer : KSerializer<CborNegativeInt>, CborSerializer {
124
126
override val descriptor: SerialDescriptor =
125
127
PrimitiveSerialDescriptor (" kotlinx.serialization.cbor.CborNegativeInt" , PrimitiveKind .LONG )
126
128
@@ -136,7 +138,7 @@ internal object CborNegativeIntSerializer : KSerializer<CborNegativeInt> {
136
138
}
137
139
}
138
140
139
- internal object CborPositiveIntSerializer : KSerializer<CborPositiveInt> {
141
+ internal object CborPositiveIntSerializer : KSerializer<CborPositiveInt>, CborSerializer {
140
142
override val descriptor: SerialDescriptor =
141
143
PrimitiveSerialDescriptor (" kotlinx.serialization.cbor.CborPositiveInt" , PrimitiveKind .LONG )
142
144
@@ -152,7 +154,7 @@ internal object CborPositiveIntSerializer : KSerializer<CborPositiveInt> {
152
154
}
153
155
}
154
156
155
- internal object CborDoubleSerializer : KSerializer<CborDouble> {
157
+ internal object CborDoubleSerializer : KSerializer<CborDouble>, CborSerializer {
156
158
override val descriptor: SerialDescriptor =
157
159
PrimitiveSerialDescriptor (" kotlinx.serialization.cbor.CborDouble" , PrimitiveKind .DOUBLE )
158
160
@@ -172,7 +174,7 @@ internal object CborDoubleSerializer : KSerializer<CborDouble> {
172
174
* Serializer object providing [SerializationStrategy] and [DeserializationStrategy] for [CborString].
173
175
* It can only be used by with [Cbor] format an its input ([CborDecoder] and [CborEncoder]).
174
176
*/
175
- internal object CborStringSerializer : KSerializer<CborString> {
177
+ internal object CborStringSerializer : KSerializer<CborString>, CborSerializer {
176
178
override val descriptor: SerialDescriptor =
177
179
PrimitiveSerialDescriptor (" kotlinx.serialization.cbor.CborString" , PrimitiveKind .STRING )
178
180
@@ -194,7 +196,7 @@ internal object CborStringSerializer : KSerializer<CborString> {
194
196
* Serializer object providing [SerializationStrategy] and [DeserializationStrategy] for [CborBoolean].
195
197
* It can only be used by with [Cbor] format an its input ([CborDecoder] and [CborEncoder]).
196
198
*/
197
- internal object CborBooleanSerializer : KSerializer<CborBoolean> {
199
+ internal object CborBooleanSerializer : KSerializer<CborBoolean>, CborSerializer {
198
200
override val descriptor: SerialDescriptor =
199
201
PrimitiveSerialDescriptor (" kotlinx.serialization.cbor.CborBoolean" , PrimitiveKind .BOOLEAN )
200
202
@@ -216,7 +218,7 @@ internal object CborBooleanSerializer : KSerializer<CborBoolean> {
216
218
* Serializer object providing [SerializationStrategy] and [DeserializationStrategy] for [CborByteString].
217
219
* It can only be used by with [Cbor] format and its input ([CborDecoder] and [CborEncoder]).
218
220
*/
219
- internal object CborByteStringSerializer : KSerializer<CborByteString> {
221
+ internal object CborByteStringSerializer : KSerializer<CborByteString>, CborSerializer {
220
222
override val descriptor: SerialDescriptor =
221
223
PrimitiveSerialDescriptor (" kotlinx.serialization.cbor.CborByteString" , PrimitiveKind .STRING )
222
224
@@ -238,7 +240,7 @@ internal object CborByteStringSerializer : KSerializer<CborByteString> {
238
240
* Serializer object providing [SerializationStrategy] and [DeserializationStrategy] for [CborMap].
239
241
* It can only be used by with [Cbor] format and its input ([CborDecoder] and [CborEncoder]).
240
242
*/
241
- internal object CborMapSerializer : KSerializer<CborMap> {
243
+ internal object CborMapSerializer : KSerializer<CborMap>, CborSerializer {
242
244
private object CborMapDescriptor :
243
245
SerialDescriptor by MapSerializer (CborElementSerializer , CborElementSerializer ).descriptor {
244
246
@ExperimentalSerializationApi
@@ -263,7 +265,7 @@ internal object CborMapSerializer : KSerializer<CborMap> {
263
265
* Serializer object providing [SerializationStrategy] and [DeserializationStrategy] for [CborList].
264
266
* It can only be used by with [Cbor] format an its input ([CborDecoder] and [CborEncoder]).
265
267
*/
266
- internal object CborListSerializer : KSerializer<CborList> {
268
+ internal object CborListSerializer : KSerializer<CborList>, CborSerializer {
267
269
private object CborListDescriptor : SerialDescriptor by ListSerializer(CborElementSerializer ).descriptor {
268
270
@ExperimentalSerializationApi
269
271
override val serialName: String = " kotlinx.serialization.cbor.CborList"
0 commit comments