When would I use ComponentContext.getComponentInstance()?

Hi,

This is just a general question, but I am wondering: Why would I need ComponentContext.getComponentInstance()? As I understand it, I would only get a ComponentContext as an activation parameter in the component itself, so wouldn’t it be easier just to use this instead? :grinning:

Would it ever be possible to obtain a ComponentContext for a component other than itself?

Thanks for any information,
Cheers,
Chris

The component instance’s this is not a ComponentInstance object. The ComponentInstance object can return the this for the component instance and it can also be used to dispose of the component instance.

OK, so a component could implement a “self-destruct” method. But the main use-case for ComponentInstancestill seems like implementing the SCR itself :grinning:.

Cheers,
Chris