Model classes vs Interfaces

Avatar

Avatar

Aryan12345

Avatar

Aryan12345

Aryan12345

01-08-2018

Hello,

I am slightly new to the world of sling models. More used to JSP and custom taglibs (and implementing my own "idea" of models by using reflections) than models. Whatever i have done with models is limited to simple injections, references and self injections.

Recently i was fooling around with some examples from the sling portal and came across this:

@Model(adaptables=Resource.class) public interface MyModel { @Inject String getPropertyName(); }

Then i started wondering why and when you would ever use interfaces? I tried simple parent child relations and it worked well.  But when would i ever write model interfaces and in which scenarios would i ever use them and how does it work?

Pardon me if the question is too basic.. but just could not get this...

thanks,

Yadhu

View Entire Topic

Avatar

Avatar

Aryan12345

Avatar

Aryan12345

Aryan12345

08-08-2018

Hi.. any other takers for this question? any help on this would be great.