Closed sato9818 closed 5 months ago
Thanks for bringing this up. The code to collect the source properties anyway had some flaws. I rewrote that now and added getter for better Java compatibility.
Your original code should work now. Only thing you probably have to do is activate konvert.enforce-not-null
(probably makes sense to enable it globally when dealing with Java classes, see https://mcarleio.github.io/konvert/options/#how-to-set-options)
@mcarleio My code works fine with the latest version. Thank you for your quick support!
Suppose I have a following java class.
I got an error with a following kotlin data class.
Error:
I could generate a converter code but also got an error with a following kotlin data class.
Generated code:
Error:
Finally, I could generate a converter code without any error by using
expression
option.Generated code:
Is there a other good way to convert than using expression option?
For
String
field, using theexpression
option is fine. However, if the field type isEnum
and,Request
andRequestDto
have differentEnum
type field, how can I convert the class by using konvert? I believeexpression
option and a custom converter are not applied at the same time.In my situaltion, Java class is generated code from protocol buffer so I can't edit it.