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

Add marker interface for pojos that can be put/get #723

Open
ZakTaccardi opened this issue Nov 29, 2016 · 4 comments
Open

Add marker interface for pojos that can be put/get #723

ZakTaccardi opened this issue Nov 29, 2016 · 4 comments
Assignees

Comments

@ZakTaccardi
Copy link

Could help a bit with type safety

storIo.put()
                .`object`(sqlData) //should fail to compile if `SqlData` does not implement the marker interface
                .prepare()
                .executeAsBlocking()
@artem-zinnatullin
Copy link
Member

Hm, interesting idea, but it will forbid you from working with classes that you don't control but have custom adapters for, like classes from libraries.

@nikitin-da thoughts?

@ZakTaccardi
Copy link
Author

@artem-zinnatullin agreed, I can see how that can be a limitation that would outweigh the benefit for users relying on that flexibility.

Here's the use case I was hoping this would solve:
I convert my StorIo POJOs into a Kotlin data class, and sometimes I forget to convert the Kotlin data class into the StorIo POJO on put operations.

@artem-zinnatullin
Copy link
Member

Yeah, I understand your pain, I catch myself everytime with same problem using Gson and other similar libraries, so I really like your proposal, but we have to check how many users may be affected by such change, since it's not backward compatible at all…

@nikitin-da
Copy link
Collaborator

Good idea to move this check to compile time, but marker interface itself will not force you to add type mapping. It looks like excess step and it will be impossible to use entities from libraries =(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants