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

Implement hierarchy helper functions #190

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

MaxMichel2
Copy link

@MaxMichel2 MaxMichel2 commented Jul 22, 2022

Adds the #186 enhancement

import com.ramcosta.destinations.sample.destinations.TypedDestination
import java.io.InvalidObjectException

inline fun <reified T> Any.asRoute(): Route? {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to me like an unnecessary pollution of the Any class. Could we make the type more specific or move the function to some other place instead of extending Any class?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought I deleted this file actually 🤔 guess I forgot it when I pushed. I'll correct this today! Thanks!

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Nek-12 I can confirm this file was deleted in the final commit. The initial idea with this function was to convert a NavGraphSpec, DestinationSpec or String? into a Route? which as you can see by the types, have very little in common 😉 But nonetheless, thank you for pointing it out! I'll make sure to be more cautious in the future!

@MaxMichel2
Copy link
Author

Hello @raamcosta, not sure how merging PR's work for you so sorry for tagging you for no reason if it's unnecessary..

This PR feels up to standard for me in terms of its contents, feel free to approve or reject it! There's probably a more elegant way of doing the same thing but hey, I'm learning the internals of your library (which I find really interesting by the way!) :)

Thanks in advance

@raamcosta
Copy link
Owner

Hello @raamcosta, not sure how merging PR's work for you so sorry for tagging you for no reason if it's unnecessary..

This PR feels up to standard for me in terms of its contents, feel free to approve or reject it! There's probably a more elegant way of doing the same thing but hey, I'm learning the internals of your library (which I find really interesting by the way!) :)

Thanks in advance

Of course! Thank you so much for this PR 🙏
And sorry I haven’t given any feedback yet. Reason is I’ve been quite busy lately so I’ve given priority to new issues and fixes I needed to do.
I will eventually check this and provide all the feedback 🙂

Thank you also for checking the code and liking it. There is quite a bit of messy parts in there that I wish I had time to clean up 😅

@raamcosta
Copy link
Owner

@MaxMichel2 sorry I still haven’t merged this, it is not forgotten.
The thing now is that I am doing quite a few changes which can probably bring new approaches to do this, so I’d rather wait for that and then recheck this PR. Thank you again 🙏

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

Successfully merging this pull request may close these issues.

None yet

3 participants