Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events

Extend Teaser Component using Sling Model Delegate Pattern to modify the Action Multifield


Level 1

Hi All,


I am trying to add one more textfield called "ariaLabel" in "call-to-actions" multifield of core Teaser component in our project by extending the "core/wcm/components/teaser/v2/teaser" component. The dialog changes looks good. But while extending the core Sling Model Teaser by using Delegation Pattern, I am not able to access the inner class "Action" which contains all the "call-to-actions" implementation. 

With the below implementation I am getting ClassNotFound exception for TeaserImpl.Action class. Could someone please help me with this?

import com.adobe.cq.export.json.ComponentExporter;
import com.adobe.cq.export.json.ExporterConstants;
import com.adobe.cq.wcm.core.components.internal.models.v2.TeaserImpl;
import com.adobe.cq.wcm.core.components.models.Teaser;
import com.day.cq.wcm.api.components.Component;
import lombok.experimental.Delegate;
import org.apache.sling.api.SlingHttpServletRequest;
import org.apache.sling.api.resource.Resource;
import org.apache.sling.api.resource.ValueMap;
import org.apache.sling.models.annotations.DefaultInjectionStrategy;
import org.apache.sling.models.annotations.Exporter;
import org.apache.sling.models.annotations.Model;
import org.apache.sling.models.annotations.Via;
import org.apache.sling.models.annotations.injectorspecific.Self;
import org.apache.sling.models.annotations.via.ResourceSuperType;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

@Model(adaptables = SlingHttpServletRequest.class,
adapters = {Teaser.class, ComponentExporter.class},
resourceType = MyTeaserImpl.RESOURCE_TYPE,
defaultInjectionStrategy = DefaultInjectionStrategy.OPTIONAL)
@Exporter(name = ExporterConstants.SLING_MODEL_EXPORTER_NAME , extensions = ExporterConstants.SLING_MODEL_EXTENSION)
public class MyTeaserImpl implements Teaser {
public final static String RESOURCE_TYPE = "xxxx/components/teaser";
@Via(type = ResourceSuperType.class)
@Delegate(excludes = DelegationExclusion.class)
private Teaser teaser;

private interface DelegationExclusion {
// Here we define the methods we want to override

public class Action extends TeaserImpl.Action {
private String ariaLabel;

public Action(@NotNull final Resource actionRes, final String parentId, Component component) {
new TeaserImpl().super(actionRes, parentId, component);
ValueMap ctaProperties = actionRes.getValueMap();
ariaLabel = ctaProperties.get("ariaLabel", String.class);

public String getAriaLabel() {
return ariaLabel;

1 Reply


Community Advisor

You can check example here, I added link style, you can add aria-lable instead


Arun Patidar