Hi, Guys,
I am new to AEM and I am facing a problem about converting Resource to Custom Model.
//--------------------------------------------------
ResourceResolver resourceResolver = request.getResourceResolver();
Resource resource = resourceResolver.getResource(path);
//--------------------------------------------------
I use the function above to get the Resource, then I use adaptTo to tranform Resource to CustomText Class.
//--------------------------------------------------
customText = resource.adaptTo(CustomText.class);
//--------------------------------------------------
But the result is null although I can get very property from getValueMap Method. But I cannot
convert it to custom class.
For my current task is that:
1. I have Page A contains Component A and Page B contains Component B
2. I want to get the Component B json or Java instance in Page A or Component A to render the Component B
with Page A together.
It is very appreciated if you guys can help me to solve problem or give me some advice to solve.
Thank you very much.