Open gaoagong opened 10 years ago
It would be nice to be able to configure an object mapper at the APNSServiceBuilder, as there has been interest in customizing this. (For example removing jackson to run on AppEngine).
I don't have time & resources to implement this right now (stability issues are pressing and I've probably already run out of budget), but would be interested if somebody would create a pull request for that.
This is a very annoying point at java-apns :)
For example, we wanted to serialize object but not serialize null or empty fields. ObjectMapper in PayloadBuilder can not be modified, so we copied all codes in class to our custom builder class.
May be there should be a constructor argument for PayloadBuilder or a method that takes an ObjectMapper as argument for serializing at build point.
I should write a simple solution on that, would be in version 1.0.0 or will you release a minor version for that ?
Thanks in advance.
If you provide a patch, we can include it in 1.0.0.
Best regards, Froh
On 19 Jun 2014, at 08:37, Onur Kağan Özcan notifications@github.com wrote:
This is a very annoying point at java-apns :)
For example, we wanted to serialize object but not serialize null or empty fields. ObjectMapper in PayloadBuilder can not be modified, so we copied all codes in class to our custom builder class.
May be there should be a constructor argument for PayloadBuilder or a method that takes an ObjectMapper as argument for serializing at build point.
I should write a simple solution on that, would be in version 1.0.0 or will you release a minor version for that ?
Thanks in advance.
— Reply to this email directly or view it on GitHub.
Life's too short not to be a fool.
Ran into an issue where I have a custom element that I want to add to the APNS payload, but the POJO has values which could be null. By default the ObjectMapper inserts null values into the payload, which is a waste of already restricted space. I was hoping for a hook to customize the ObjectMapper used or to at least retrieve the one being used, but it is private static and can't be touched.
I am going to extend the class and only override the method that is using the ObjectMapper, but I think that this functionality should be available by default.