I’m relatively new to AEM development. I have recently had to extend one of the core components. Why is it that we extend the interfaces that those components implement, rather than extending the class itself, so that our child class has direct access to all the parents’ methods?
From my understanding, in order to access the parent component’s class methods, we have to instantiate the parent class as a field in the child class with @Self and @Via, and mark it as a superclass. Why can we not just extend the parent class like any other java parent-child relationship?
For example, to extend the Core Form Options component, I had to create a child class that implements the Option interface instead of extending the OptionsImpl class. Then, I had to have a field within my child class that holds the parent component in order to access its public methods, instead of calling directly from the child. Why is that?