File tree Expand file tree Collapse file tree 1 file changed +8
-10
lines changed Expand file tree Collapse file tree 1 file changed +8
-10
lines changed Original file line number Diff line number Diff line change @@ -168,11 +168,10 @@ types:
168
168
The following code shows how to construct a ``CodecRegistry`` by using
169
169
the ``fromCodecs()`` method:
170
170
171
- .. literalinclude:: /includes/data-formats/codecs.kt
172
- :language: kotlin
173
- :start-after: start-fromcodecs
174
- :end-before: end-fromcodecs
175
- :dedent:
171
+ .. code-block:: kotlin
172
+
173
+ val codecRegistry = CodecRegistries
174
+ .fromCodecs(IntegerCodec(), PowerStatusCodec())
176
175
177
176
The preceding example assigns the ``CodecRegistry`` the following ``Codec``
178
177
implementations:
@@ -184,11 +183,10 @@ implementations:
184
183
You can retrieve the ``Codec`` instances from the ``CodecRegistry`` instance
185
184
by using the following code:
186
185
187
- .. literalinclude:: /includes/data-formats/codecs.kt
188
- :language: kotlin
189
- :start-after: start-retrieve-codecs
190
- :end-before: end-retrieve-codecs
191
- :dedent:
186
+ .. code-block:: kotlin
187
+
188
+ val powerStatusCodec = codecRegistry.get(PowerStatus::class.java)
189
+ val integerCodec = codecRegistry.get(Integer::class.java)
192
190
193
191
If you attempt to retrieve a ``Codec`` instance for a class that is not
194
192
registered, the ``codecRegistry.get()`` method raises a
You can’t perform that action at this time.
0 commit comments