Accessing Component Level Policy Using PolicyManager
AEM version : 6.5
I have created a proxy component for the OOTB Carousel Component. Now I have defined a custom parameter or a field in the cq:design_dialog. ( as shown in image given below )

Now i have authored the aforementioned parameters by editing the component policy as shown below

Now after saving this , Its stored as follows ( Please refer below image )

How do i access this particular property programmatically ?
I did created a sling model as given below And i am trying to access the same in Sightly
public class CarouselPolicy {
@SlingObject
private ResourceResolver resourceResolver;
/** The resource. */
@1961677
private Resource resource;
private int carouselItemLimit;
private static final Logger LOG = LoggerFactory.getLogger(CarouselPolicy.class);
@PostConstruct
public void init(){
ContentPolicyManager policyManager = resourceResolver.adaptTo(ContentPolicyManager.class);
if (policyManager != null) {
ContentPolicy contentPolicy = policyManager.getPolicy(resource);
if (contentPolicy != null) {
LOG.trace("carouselItemLimit "+carouselItemLimit);
carouselItemLimit= (Integer) contentPolicy.getProperties().get("carouselItemLimit");
}
}
}
/**
* @2007960 carouselItemLimit
*/
public int getCarouselItemLimit() {
return carouselItemLimit;
}
}
The contentPolicy is coming as Null. Is this the correct approach ? What am i missing here ?