[
https://jira.jboss.org/browse/SHRINKWRAP-240?page=com.atlassian.jira.plug...
]
Dan Allen commented on SHRINKWRAP-240:
--------------------------------------
The way I see it, since I'm calling up the class by referring to it by it's Class
object, then to me that says I'm giving the archive both the class and the intent to
register it as a service provider. So I expect it will figure out how to add that class to
the backing archive if possible.
In the case of descriptors, I don't think we have to be adding the class specifically
because I think in the case the intent is really to build a configuration file, not to add
resources (as you are in the context of a descriptor, not an archive).
So, I still stand behind having addServiceProvider offer the feature of adding the class
if it isn't already added. The right solution is to perhaps offer a second method that
provides this capability:
addServiceProvider(boolean addProviderClasses, Class<?> serviceInterface,
Class<?>... serviceImpls)
Adds one line with the full-qualified class name for each service implementation
specified to a file in META-INF/services that has the same name as the service interface.
If addProviderClasses is true, the classes are also added the the parent ClassContainer.
Thus, we keep addServiceProvider as is, and this new method can be used to handle the dual
work.
addServiceProvider(true, Service.class, MyServiceImpl.class)
addServiceProvider should add class to archive
----------------------------------------------
Key: SHRINKWRAP-240
URL:
https://jira.jboss.org/browse/SHRINKWRAP-240
Project: ShrinkWrap
Issue Type: Feature Request
Components: api
Affects Versions: 1.0.0-alpha-11
Reporter: Dan Allen
Priority: Minor
My intuition tells me that addServiceProvider should add the service provider classes I
specify to the archive. To my surprise, it does not. I can't see any scenario in which
you specify a service provider for a class that isn't in the archive. For the edge
case, you could always extract it manually after the call to addServiceProvider.
Currently:
addClass(MyServiceImpl.class).addServiceProvider(Service.class, MyServiceImpl.class)
Proposed:
addServiceProvider(Service.class, MyServiceImpl.class)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://jira.jboss.org/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira