MdelFactory | Community
Skip to main content
Keerthi0555
Level 5
May 10, 2023
Solved

MdelFactory

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.
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:

2 replies

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:

Translate
Keerthi0555
Level 5
May 15, 2023

Thank you.

Translate