Highlighted

Usage of Sling Model

akash_gupta2

03-09-2018

Which one of the following a better way of defining a sling model and why?

@Model(adaptables=Resource.class)

public interface MyModel {

     @Inject

     String getPropertyName();

}

      OR

@Model(adaptables=Resource.class)

public class MyModel {

     @@Inject

     private String propertyName;

}

Can you tell me a defined use case for using an interface as a model when all the methods are to be overridden in all the implementation classes?