Skip to content
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

Consider Unit response from type converter as 'not supported #12

Closed
denis-zhdanov opened this issue Oct 9, 2019 · 0 comments
Closed
Assignees

Comments

@denis-zhdanov
Copy link
Owner

Problem

Currently it's possible to specify custom type converter via Context.Builder.withTypeConverter(). That function is expected to return a non-null value as an indication that it did a conversion and null otherwise.

So, a sample usage is like below:

builder.withTypeConverter { value, targetType ->
    if (targetType == Element::class) {
        Element(value.toString().toInt())
    } else {
        null
    }

However, it would be more convenient to treat the returned value of type Unit in the same way as null:

builder.withTypeConverter { value, targetType ->
    if (targetType == Element::class) {
        Element(value.toString().toInt())
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant