MdelFactory | Community
Skip to main content
Keerthi0555
New Participant
May 10, 2023
Solved

MdelFactory

  • May 10, 2023
  • 1 reply
  • 1552 views

Hi Team,

 

I went through the BYline Component of wknd tutorial there I found this line

modelFactory.getModelFromWrappedRequest(request, request.getResource(), Image.class);
 
what getModelFromWrappedRequest method does?
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by lukasz-m

Hi @keerthi0555,

In general getModelFromWrappedRequest is used to create new Sling Model base on given request, resource and class type that defines what type is expected. This approach allows to simplify implementation by reusing existing models.

In given example - Byline component - above method is used to create Image model.

Here are also some links:

1 reply

lukasz-m
lukasz-mAccepted solution
New Participant
May 11, 2023

Hi @keerthi0555,

In general getModelFromWrappedRequest is used to create new Sling Model base on given request, resource and class type that defines what type is expected. This approach allows to simplify implementation by reusing existing models.

In given example - Byline component - above method is used to create Image model.

Here are also some links:

Keerthi0555
New Participant
May 15, 2023

Thank you.