Quote's of the day
"You never fail until you stop trying"
What is Sling Resource Merger?
- Sling Resource Merger is the hidden engine that makes AEM’s inheritance powerful.
- It allows developers to extend, reuse, and customize components efficiently — without touching the original ones.
sling:resourceSuperType to point to the parent component.- We have an existing component in our AEM project (not core, our own).
- We found that our new component will use 80% of the same fields.
- So, instead of copying everything, we decide to extend and customize it.
Step 1: Create a (PersonalInfoExtend) new Component & extend the existing component with sling:resourceSuperType Property.
com.adobe.aem.guides.wknd.core.models.- The
PersonalInfoExtendinterface extends another interface calledPersonalInfo. -
This means it inherits all methods from
PersonalInfo. Along with the inherited methods, it also adds two new methods:
-
getAge()→ to fetch or return the user’s age. -
getSalary()→ to fetch or return the user’s salary.
This approach helps in reusing existing functionality (fromPersonalInfo) and extending it with new fields without changing the original code.-
PersonalInfoExtendImpl inside the packagecom.adobe.aem.guides.wknd.core.models.
Explanation - This class implements the interface
PersonalInfoExtend— meaning it provides the actual logic (or data) for the methods defined in that interface. - It also extends another class,
PersonalInfoImpl, so it inherits all the existing properties and methods from it.