-
Notifications
You must be signed in to change notification settings - Fork 28
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
Request to modify/enhance @Provides decorator functionality #78
Comments
Hi, About the 1st part:
This would be a nice feature 👍 About the 2nd part:
Thanks for the idea :)
I didn't use it directly, I was only doing Maven stuffs when I was working in Java :) |
Hi, the The qualname change might break existing code, indeed. So I'll leave that up to you to decide on. But on the long run, I guess it's the better way. Now, I also now it can cause issues when classes are referenced from modules that have different sys.path setups (it adds extra package names in the hierarchy). So, this should be well-documented and explained. |
Hi, As the qualname change will break some existing projects, I suggest we provide both forms of the specification (short, actual, one and the fully qualified one). About the computation of the full name, I think it could be possible to get the folder of the |
Hi,
Thanks for considering these changes :) |
Hi,
I agree
That could be a solution, I suppose we could then swap the default value in a future release then remove it.
That way, the legacy doesn't have to be changed at all, and the use the full name can be activated/tested using a single line of code. What do you think ? |
I think that seems a good proposal, yes. |
If you'd like, I can implement this and make a pull request for you? See https://github.com/tbr/ipopo/tree/new_provider branch. |
Hi,
I won't be able to work on iPOPO before sunday, so if you have time before
that, you can do it if you want :)
2017-05-04 8:46 GMT+02:00 tbr <notifications@github.com>:
… If you'd like, I can implement this and make a pull request for you?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#78 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ABeB5h4zEygi_JfrJppPOXdUdKgqla0Qks5r2XRFgaJpZM4NLNdY>
.
|
The work is done and available in the new_provider branch, I suggest you review it first (when having the time) and then I'll merge it to master and create a pull request. |
Hi, I'd just change two lines for the code style:
But apart from those style details, it's good to me 👍 |
Closing, as this feature is bundled in iPOPO 0.6.5. |
Hi,
I want to propose a small change to the
@Provides
decorator. Often (as in OSGi) service classes implement interfaces, and the interfaces define how the service can be used. Currently in iPopo, the programmer of such service is required to repeat in the specifications property the list of interfaces that are defined by the class. In order to simplify this, I made a functionality change that allows iPopo to detect the direct implemented bases and use those as specifications.To the point, with my proposal the
@Provides
decorator can havespecifications=None
, which will trigger it to use the__bases__
of the class object as specifications. Thus the following can be written (example):Secondly, I think it is not sufficient to use name when passing a class as specification, as this might collide with other classes having the same name. I modified this to use
__module + "." + __qualname__
as specification instead. Now, 'module' is not guaranteed to contain a valid value, but afaik it's more often set than not (the code checks this).It's just a proposal, feel free to disregard it, or comment on it. Of course, it would be great to (from my perspective) to have it accepted and merged into iPopo :)
The code is in decorators.py on https://github.com/tbr/ipopo/tree/new_provider
PS: I am influenced a lot by bndtools on Java.
The text was updated successfully, but these errors were encountered: