Skip to content

Commit b1e6575

Browse files
committed
updated GenCodec docs
1 parent 022ce6d commit b1e6575

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

docs/GenCodec.md

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,10 @@ The library by default provides codecs for common Scala and Java types:
9494
* Any `Array[T]`, provided that `T` can be serialized
9595
* Any Scala collection extending `scala.collection.Seq[T]` or `scala.collection.Set[T]`, provided that `T` can be serialized
9696
* Any `java.util.Collection[T]`, provided that `T` can be serialized
97-
* Any `scala.collection.Map[K,V]` provided that `K` and `V` can be serialized. By default, maps are serialized as lists
98-
of key-value pairs, unless there is an implicit `GenKeyCodec` available for the key type `K` (see later).
99-
In that case, keys can be represented as `String`s and the map can be serialized as an object.
100-
* Any `java.util.Map[K,V]`, provided that `K` and `V` can be serialized. [`GenKeyCodec`](http://avsystem.github.io/scala-commons/api/com/avsystem/commons/serialization/GenKeyCodec.html)
101-
existence for `K` applies in the same way as for Scala `Map`.
97+
* Any `scala.collection.Map[K,V]` provided that `V` can be serialized and there is an implicit
98+
[`GenKeyCodec`](http://avsystem.github.io/scala-commons/api/com/avsystem/commons/serialization/GenKeyCodec.html) available for `K`
99+
so that it can be converted to a string and used as object key.
100+
* Any `java.util.Map[K,V]`, with the same restrictions as for Scala maps (there must be `GenCodec` for `V` and `GenKeyCodec` for `K`)
102101
* `Option[T]`, `Opt[T]`, `OptArg[T]`, `NOpt[T]`, `OptRef[T]`, provided that `T` can be serialized.
103102
* `Either[A,B]`, provided that `A` and `B` can be serialized.
104103
* [`NamedEnum`](http://avsystem.github.io/scala-commons/api/com/avsystem/commons/misc/NamedEnum.html)s
@@ -118,10 +117,6 @@ and Java `Map` types. By default, following types have [`GenKeyCodec`](http://av
118117
whose companion object extends [`NamedEnumCompanion`](http://avsystem.github.io/scala-commons/api/com/avsystem/commons/misc/NamedEnumCompanion.html)
119118
* Java enums
120119

121-
If there is no [`GenKeyCodec`](http://avsystem.github.io/scala-commons/api/com/avsystem/commons/serialization/GenKeyCodec.html)
122-
available for some type `K`, then `Map[K,V]` will be serialized into a list of key-value
123-
pairs (each pair represented as an object with two fields).
124-
125120
## Serializing and deserializing examples
126121

127122
To serialize and deserialize values, you can use the [`read`](http://avsystem.github.io/scala-commons/api/com/avsystem/commons/serialization/GenCodec.html#read(input:com.avsystem.commons.serialization.Input):T)

0 commit comments

Comments
 (0)