New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ability to define custom mappers #66
Comments
Yes since ReMap is a Java Bean mapper it only works for properties. This restriction was chosen to make the mapper testable using the assert API of ReMap. If one could define a mapper CharSequence -> String that automatically applies to all field mappings maching this types, we should also extend the Assert API to expect that in tests. Quite interesting idea - thank you for that. We will think about that. |
please try to come up with some solution, since if we talk about mapping avro to java TO, it means, that I have to replace every single field like: .replace(…, …).with(AvroUtil::charSeqToString) where: public static String charSeqToString(CharSequence seq) { because there is no mapper CharSequence->String, and I cannto declare one. |
Just to get that right, the field names in your example are equal for the classes but they differ in the fact that the one has |
right. |
You may want to have a look at #70. Especially the test case |
Is there any interest in this feature? |
Ach! Sorry for not responding, I overlooked the mail.
There is interest, indeed. Tests seems nice, I fetch your changes and tests
them in our project, and will be in touch (for some reason, clone does not
work here right now).
And I will be *sooner* in touch.
Thanks!
Martin.
po 5. 11. 2018 v 15:00 odesílatel Christopher Schütte <
notifications@github.com> napsal:
… Is there any interest?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#66 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AJNSxNfHyoAA-4EGmY48jH0BOoMqatUZks5usER6gaJpZM4X1cLU>
.
|
Ok, I can confirm, that your changes work for us.
Thanks!
… |
The pull request was merged and I released the version 4.1.0 a few minutes ago. It will be available through JCenter or Maven Central in a few hours. |
I'm mapping generated AVRO file to say JPA entity. But generated AVRO has Strings as CharSequence, for which there is no Mapper for. OK, so we
useMapper
:.useMapper(Mapping.from(CharSequence.class).to(String.class).mapper())
but ... that won't work, since there is not (reasonable) properties to map and string is immutable. So we need to be able to replace whole class to define such mapper. Currently I don't see such option.
The text was updated successfully, but these errors were encountered: