Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

MdelFactory

Avatar

Level 4

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: