factcast icon indicating copy to clipboard operation
factcast copied to clipboard

Make SnapshotSerializerSupplier take a list of SnapshotSerializer's to be able to use beans with non default constructor

Open otbe opened this issue 4 years ago • 5 comments

Right now we are only able to use

@SerializeUsing(SnapSer.class)

with classes that have a no-arg constructor but this is not strictly necessary 🤔

otbe avatar Oct 06 '21 12:10 otbe

return serializers.computeIfAbsent(ser, SnapshotSerializerSupplier::instanciate); -> first check if given class is one of the injected

BernhardBln avatar Oct 28 '21 13:10 BernhardBln

Inject all SnapshotSerializer beans

BernhardBln avatar Oct 28 '21 13:10 BernhardBln

@otbe I assume it is fine to pick the first match where we either have a default constructor, or we find it in the list? Or you had other priorities in mind?

BernhardBln avatar Nov 01 '21 09:11 BernhardBln

And what to do if none match (e.g. all Serialisers are beans, but not found in the list), throw SerializerInstantiationException?

BernhardBln avatar Nov 01 '21 09:11 BernhardBln

Current state: There is some problem and we wait for feedback on that before proceeding, see https://github.com/factcast/factcast/pull/1668#issuecomment-956281582

BernhardBln avatar Nov 01 '21 14:11 BernhardBln