Javax JCR Node getProperties and Titles

3.3k views Asked by At

I am given a Node and I then request form it another Node.

Node nn = node.getNode("jcr:content");

From here I can do the following to get the value of

nn.getProperty("cq:lastModified")

What I am trying to do is get all the properties without asking for each one by name.

Node nn = node.getNode("jcr:content");
PropertyIterator pi = nn.getProperties();

Now I can iterate over the properties and print their values as so:

while(pi.hasNext())
{
   Property p = pi.nextProperty();
   String val = p.getString();
}

But how can I find the title of this Property?

1

There are 1 answers

0
vivekpansara On BEST ANSWER

I am not sure but you can try getName() method because Property interface is subinterface of Item interface. You can try like below :

while(pi.hasNext())
{
   Property p = pi.nextProperty();
   String name = p.getName();
   String val = p.getString();
}