1

I'm using Salat library to serialize objects to be stored in MongoDb via Casbah. Sometimes I need to tune little bit how fields will be serialized, and Salat's Annotations is a pretty convenient way to do it.

BUT, Is there any way to describe serialization parameters(Key, Ignore etc) not directly in case-classes(models) via Annotations, but in some external point, to keep my models clear from Salat dependency(aka POJO/POCO)?

alekseevi15
  • 1,732
  • 2
  • 16
  • 20

1 Answers1

2

Yes, you can add custom serialization logic to your Salat context.

Example from Salat unit tests:

WibbleTransformer

Custom context with custom transformers added

noahlz
  • 10,202
  • 7
  • 56
  • 75
  • Thanks, this is not to say a super-convenient way to tune serialization, but, probably, the only one we can use in "external point". Anyway, it works. – alekseevi15 Mar 19 '15 at 07:18