While creating a sling model we can register it through a resource type. Is there any way through which we can get the sling model class name by providing resource type in AEM. For example : if i have a resource type /mysite/component/breadcrumb and sling model is BreadCrumbModel.java . Is there OOTB service through which if i pass the resourceType value and get the class refernece.
Thanks
Yes, from either the provided
Resource
orSlingHttpServletRequest
of the resource.ModelFactory API Docs
Usage example: If
SlingScriptHelper
is injected in your class -or if you already have
ModelFactory
injected and available, use it directly.