如何确定JCR属性是否为多值? [英] How to determine if a JCR property is multivalue?

查看:70
本文介绍了如何确定JCR属性是否为多值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何确定JCR属性是否为多阀?我尝试在属性上调用getType(),但是如果它是字符串或字符串数​​组,则返回相同的值。

How do you determine if a JCR property is multivalve? I tried calling getType() on the property but that returns the same value if it's a String or String Array.

谢谢!

推荐答案

使用isMultiple()方法/docs/en/spec/javax.jcr/javadocs/jcr-2.0/javax/jcr/Property.html rel = nofollow noreferrer>属性类,您可以确定该属性是否为多值

Using the isMultiple() method of the Property class you can determine if the property is multi-valued or not.

Property prop = node.getProperty("some-property");
if (prop.isMultiple()) {
    //do something
} else {
    //do something else
}

这篇关于如何确定JCR属性是否为多值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆