public class ListImpl extends com.adobe.cq.wcm.core.components.internal.models.v1.ListImpl implements List
Is it possible to do same in a client aem project or extending core models restricted to core aem project ?
Solved! Go to Solution.
Views
Replies
Total Likes
Hi @sreenu539,
All models located under internal package are not exported by core components bundles. This means you cannot use them directly, this is done by design.
The proper way to extend Core Components model is to use delegation pattern. Here you can find some information with examples:
@Model(adaptables = SlingHttpServletRequest.class,
adapters = List.class,
resourceType = "myproject/components/list")
public class ListImpl implements List {
@Self
@Via(type = ResourceSuperType.class)
private List list;
/**
* using original implementation
*/
@Override
public String getDateFormatString() {
// place for custom implementation that will be different comparing to orignal one
}
/**
* using original implementation
*/
@Override
public boolean linkItems() {
// simply run method from Core Components List implementation
return list.linkItems();
}
// place for other methods from List interface
}
Hi @sreenu539,
All models located under internal package are not exported by core components bundles. This means you cannot use them directly, this is done by design.
The proper way to extend Core Components model is to use delegation pattern. Here you can find some information with examples:
@Model(adaptables = SlingHttpServletRequest.class,
adapters = List.class,
resourceType = "myproject/components/list")
public class ListImpl implements List {
@Self
@Via(type = ResourceSuperType.class)
private List list;
/**
* using original implementation
*/
@Override
public String getDateFormatString() {
// place for custom implementation that will be different comparing to orignal one
}
/**
* using original implementation
*/
@Override
public boolean linkItems() {
// simply run method from Core Components List implementation
return list.linkItems();
}
// place for other methods from List interface
}