java - Sling - Loop through properties of a resource -


i'm used using nodes in sling , accustomed looping through nodes like:

nodeiterator headernode = currentnode.getnodes(); //loop through , 

but how if i'm trying loop through properties of resource. i'm lost here. i'm grabbing single property of resource. if want grab properties of said resource how that?

resource getresource = resourceresolver.getresource("/content/aboutpage/jcr:content/list"); valuemap property = getresource.adaptto(valuemap.class); string title = property.get("jcr:lastedited", string.class); 

any appreciated!

as valuemap extends java.util.map can use entryset() method:

resource getresource = resourceresolver.getresource("/content/aboutpage/jcr:content/list"); valuemap property = getresource.adaptto(valuemap.class); for(entry<string, object> e : property.entryset()) {     string key = e.getkey();     object value = e.getvalue();     //use key , value here } 

Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -