Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
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: