Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.

Override data-sly-use java class

Avatar

Level 2

Hello! Can I override the data-sly-use attribute in the parent resourceSuperType with a new class? as of now I can't override it with the new java class

3 Replies

Avatar

Community Advisor

@AEMStarterNewbie 

Though I am not 100% sure what do you mean by Overriding data-sly-use java class, but I think you are trying to override the class that is invoked using data-sly-use. To achieve that you can simply overlay the markup where the data-sly-use is placed and in the new markup you can put your own implementation.

Similar scenario: https://stackoverflow.com/questions/28571842/display-different-markup-in-sightly-based-on-a-sling-se...

Avatar

Community Advisor

Hi @AEMStarterNewbie :

Please refer- https://experienceleague.adobe.com/docs/experience-manager-core-components/using/developing/customiz...
Here it is clearly mentioned how in a custom/extended component, behavior/method from a parent component is overridden.

 

The Business logic for the core components is implemented in Sling Models. This logic can be extended by using a Sling delegation pattern.
For example, the title core component uses the jcr:title property of the requested resource to provide the title text. If no jcr:title property is defined, a fallback to the current page title is implemented. We want to change the behavior so that the title of the current page is always displayed.

Because the implementation of the Core Components’ models are private, they must be extended with a delegation pattern.

 

Please let me know if this is what you are trying to do.
Thanks.