We can check the type of property(whether single or multiple) using the method isMultiple() of Property interface. Below is an example to check the node property "items" is a single value or multiple values and based on that get the value or values for that property in AEM.
Property property = node.getProperty("items");
Value[] values = null;
if(property.isMultiple()){
values = property.getValues();
} else {
values[0] = property.getValue();
}
Hope this helps. Thank you!
No comments:
Post a Comment