Matthias247 / jawampa

Web Application Messaging Protocol (WAMP v2) support for Java
Apache License 2.0
148 stars 57 forks source link

Expose ObjectMapper in WampClient #23

Closed jrogers closed 9 years ago

jrogers commented 9 years ago

If a client is using custom Jackson serializers for its objects, it would be useful to be able to register them with the ObjectMapper used in the WampClient, so that objects with custom serializers are serialized/deserialized properly - see external serializer example using modules on http://wiki.fasterxml.com/JacksonHowToCustomSerializers. Currently because it's not exposed, it's limited to using POJO or annotations, and cannot support modules.

Could we either expose the objectMapper field in the WampClient through a getter, or allow a custom ObjectMapper to be passed when building the client?

I can probably create a pull request for either, but wanted to discuss it first.

Matthias247 commented 9 years ago

I don't know exactly if modifying the ObjectMapper of the Client helps for custom serialization - because the ObjectMappers that are used for serialization are those in the Serialization class.

If it helps then I would also propose to add a getter for the ObjectMapper to the WampClient and a allow to set it to a custom value through the Builder. If null is set (default value) then a new ObjectMapper gets constructed.

jrogers commented 9 years ago

Please disregard this, I will close it. You are right, it doesn't help. I was looking at an example where I was trying to customize the data binding between a POJO without annotation but it seems like it wouldn't have worked anyway.