On Wed, 2014-12-03 at 15:19 -0500, Justin Edelson wrote:
> @Component
> @Service
> @Reference(referenceInterface=Adaptation.class,
> target="(&(adaptable=com.myco.MyClass)(adaptable=org.apache.sling.api.Resource))")
> public class Foo {
>
> public void doSomething(Resource resource) {
> MyClass cfgMan =
> resource.adaptTo(MyClass.class)
> }
>
> }
Actually the complete @Reference must be a bit more verbose, at least to
make the scr plugin happy:
@Reference(referenceInterface=Adaptation.class,target="(&(adaptable=com.myco.MyClass)(adapter=org.apache.sling.api.Resource))",name
= "ignore", strategy = ReferenceStrategy.LOOKUP)
I took a quick stab at a patch ( org.apache.sling.adapter only, no SCR
annotations for now), and the changes are not major and contained to the
AdapterImpl, but testing ( both JUnit and manual ) is going to be a
drag.
Therefore before committing more time to this I'd like to know if there
are any concerns with the proposed solution or any ideas on how to make
it better.
Cheers,
Robert