Reading Child/Grand Child properties in Sling Model

Avatar

Avatar

raghava_joijod1

Avatar

raghava_joijod1

raghava_joijod1

05-05-2019

Hi,

Is there any way we can access child/grand child valuemap in sling model.

Ex.  If my current resource is "/content/1/2"

And I would like to read property available at node "/content/1/2/x/y/5",  and x, y values may vary.

I found DeepModifiableValueMapDecorator,  will this help?

Thanks,

Raghava

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar

Arun_Patidar

MVP

Total Posts

2.9K

Likes

1.0K

Correct Answer

831

Avatar

Arun_Patidar

MVP

Total Posts

2.9K

Likes

1.0K

Correct Answer

831
Arun_Patidar
MVP

05-05-2019

you can inject self as reosurce and check other childs(grand childs) with java code using Resource API.

@Self

    private Resource resource;

Resource (Apache Sling 8 API)

Answers (0)