How to get node property array values ​​in jcr

Need help getting the values ​​of the string [] of the node property

for example, I have a node image that has a link property of type String []. I need to get the first value of an array.

thanks

+4
source share
2 answers

From Node, you can get the link property. And then call getValues ​​to the reference values. From there, just take the first one. Sort of

public String getFirstReference(Node node) throws RepositoryException { Property references = node.getProperty("references"); Value[] values = references.getValues(); return values[0].getString(); } 
+10
source
 Property nProp = node.getProperty("references"); Value[] values = propertyNode.getValues(); for (Value v : values) { System.out.println("Property Name = "+nProp.getName()+" ; Property Value= "+v.getString()); } 
+2
source

All Articles