Closed AlexanderMann closed 7 years ago
When specifying a writer for the transit java library, allow for a default writer to be passed in.
I've recently run into wanting to have the ability to have a default writer for transit. Presently, there is a concept of a default reader (https://github.com/cognitect/transit-java/blob/master/src/main/java/com/cognitect/transit/DefaultReadHandler.java) but for writing the ability to override objects at a base level isn't quite as straightforward.
Since finding a write handler works by first traversing the object inheritance then the abstracts implemented, you cannot use an Object or Serializable default writer. You almost have to have the ability to specify a default writer somewhere around here: https://github.com/cognitect/transit-java/blob/master/src/main/java/com/cognitect/transit/impl/WriteHandlerMap.java#L137
Object
Serializable
Happy to implement this as a library on top of transit-java or even as a fork if that's the best path forward here. I'm using the transit-clj library and have found it to be pretty excellent.
Fixed in 0588d87.
Released in transit-java-0.8.327.
Request
When specifying a writer for the transit java library, allow for a default writer to be passed in.
Motivation
I've recently run into wanting to have the ability to have a default writer for transit. Presently, there is a concept of a default reader (https://github.com/cognitect/transit-java/blob/master/src/main/java/com/cognitect/transit/DefaultReadHandler.java) but for writing the ability to override objects at a base level isn't quite as straightforward.
Since finding a write handler works by first traversing the object inheritance then the abstracts implemented, you cannot use an
Object
orSerializable
default writer. You almost have to have the ability to specify a default writer somewhere around here: https://github.com/cognitect/transit-java/blob/master/src/main/java/com/cognitect/transit/impl/WriteHandlerMap.java#L137Happy to implement this as a library on top of transit-java or even as a fork if that's the best path forward here. I'm using the transit-clj library and have found it to be pretty excellent.