Adapting metadata node to object is returning null
I need to adapt document metadata node to an object. The code is as below. But the object returns null. Did anyone face similar issue?
Resource resource = resourceResolver.getResource(destinationPath+"/"+JcrConstants.JCR_CONTENT+"/metadata");
DocumentInfo documentInfo = resource.adaptTo(DocumentInfo.class);