Hi,
One ongoing problem (which has been a bit exacerbated by Sling Models)
is when code depends upon the AdapterManager being able to handle a
particular adaptation. Right now, the only way to deal with this is by
listening for the AdapterManager events. But these events aren't
particularly easy to deal with; it would be easier if this was based
on the service registry.
What I would like to see is that the AdapterManager registers some
kind of marker service when an adaptation is available.
>From the consuming side, it would look like this:
@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)
}
}
WDYT?
Regards,
Justin