Get Multifield List values to Sling Model | Community
Skip to main content
July 15, 2016

Get Multifield List values to Sling Model

  • July 15, 2016
  • 1 reply
  • 2752 views

I need Multifield List values to Sling Model class

For single value property we call

@inject

@Named("Author")

@Via("resource")

String authorPath;

But i have property contains String[] that have JSON type, How can i get that values in sling Model class variable 

Can i get like below

@Inject

@Via("resource")

Private List<> authorList;

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

1 reply

Peter_Puzanovs
Community Advisor
Community Advisor
July 15, 2016

Dear Brahma,

Kindly refer to the Sling documentation for Sling Models[1].

Notice, section that describes how to create custom annotation on the same page[2]

What it describes, is that you could create a custom annotation for your multi-field list type. Which would parse the data from JCR to your Data model in your preferred way with your own custom logic.

[1] https://sling.apache.org/documentation/bundles/models.html

[2] https://sling.apache.org/documentation/bundles/models.html#custom-annotations

Regards,

Peter