Not able to extends from Core Components





I have to extend the existing implementation of com.adobe.cq.wcm.core.components.internal.models.v2.PageImpl, because I have to provide an additional css class to getCssClassNames method based on some settings in page properties. But its not possible to extend this class because this class is in the "internal" package. And as I know this will not be exported to other OSGi bundles.


For me this means, I have to copy the code from v2.PageImpl and v1.PageImpl and all other used classes which are also in "internal" package to my project. In my opinion this kind of implementation of core components does not make any sense, because it blocks developers to reuse existing code.


Or does somebody have a solution for this problem?




Accepted Solutions (1)

Accepted Solutions (1)



Hello @Reini- 

Since core implemented classes are in the internal package, you can't extend these classes into your package.
This is expected behavior, you can get more info about this limitation here
I would suggest here, you don't need to copy all the code from the core implementation class (,
you can use the Delegation pattern for sling models. For this, you have to write a model class and  you can add you're own methods something like below

public class MyPageImpl implements Page  {

@Via(type = ResourceSuperType.class)
private Page page;  // here you'll get the actual implementation class of PageImpl

public String getAppResourcesPath() {
return page.appResourcesPath;

public String getCssClassNames() {
return "my-css-class-name"


You've to use this model in your HTL file and you're component must inherit from the core page component.



Answers (4)

Answers (4)





It is the decision of the core component team to hide the implementation classes. My recommendation is to have that discussion at the core components repository at

You get the best answers there for this question.