Expand my Community achievements bar.

SOLVED

MdelFactory

Avatar

Level 6

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?
1 Accepted Solution

Avatar

Correct answer by
Community Advisor

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:

View solution in original post

2 Replies

Avatar

Correct answer by
Community Advisor

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: