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

Kotlin Pair for rxAsyncGet? #1

Closed
AsyncMoksha opened this issue Dec 16, 2016 · 3 comments
Closed

Kotlin Pair for rxAsyncGet? #1

AsyncMoksha opened this issue Dec 16, 2016 · 3 comments

Comments

@AsyncMoksha
Copy link

It seems like if my java project uses rxAsyncGet, it has to know Kotlin's Pair class since that's part of its return type. I don't want my java project to know anything about Kotlin, what's a good solution?

@jacinpoz
Copy link
Owner

jacinpoz commented Dec 17, 2016

Java 8 does not have a proper class to represent a Tuple or a Pair (although javafx has one). I could have used any of the third party libraries implementing it (like Apache Commons), but it would add an extra dependency on the project for a very silly addition.

I decided to use Kotlin Pair because Kotlin is already part of the project, and it has good language support.

However, I do understand your position and if it makes it any better, I can create a wrapper class called "AerospikeKeyValue" or "AerospikeResult" and return this instead.

What do you think about this solution?

@AsyncMoksha
Copy link
Author

AsyncMoksha commented Dec 18, 2016 via email

@jacinpoz
Copy link
Owner

I implemented AerospikeResult<V> and AerospikeArrayResult<V> data wrappers. They replace Kotlin's Pair class and use a generic value for the result. This decision was made because Aerospike get/exists/execute operations always return a Key or an array of Key objects, but the result itself could be a Boolean (exists operation), a Record (get operation) or any Object (execute operation).

The changes are available in version 0.3.0.

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

2 participants