change serialization to strictly rely on subtyping
- when encountering new message type, check all bindings which map apply - if multiple are found, choose the most specific one if that exists or verify that all mappings yield the same serializer - in case of remaining ambiguity, throw exception - also add special handling for “none” serializer mapping: turn off a default
This commit is contained in:
parent
50d107e150
commit
8b9f1caf67
6 changed files with 72 additions and 44 deletions
|
|
@ -179,14 +179,10 @@ class SerializeSpec extends AkkaSpec(SerializeSpec.config) {
|
|||
ser.serializerFor(classOf[ExtendedPlainMessage]).getClass must be(classOf[TestSerializer])
|
||||
}
|
||||
|
||||
"resolve serializer for message with several bindings" in {
|
||||
ser.serializerFor(classOf[Both]).getClass must be(classOf[TestSerializer])
|
||||
}
|
||||
|
||||
"resolve serializer in the order of the bindings" in {
|
||||
ser.serializerFor(classOf[A]).getClass must be(classOf[JavaSerializer])
|
||||
ser.serializerFor(classOf[B]).getClass must be(classOf[TestSerializer])
|
||||
ser.serializerFor(classOf[C]).getClass must be(classOf[JavaSerializer])
|
||||
"throw exception for message with several bindings" in {
|
||||
intercept[java.io.NotSerializableException] {
|
||||
ser.serializerFor(classOf[Both])
|
||||
}
|
||||
}
|
||||
|
||||
"resolve serializer in the order of most specific binding first" in {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue