Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/372.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Magnolia JCR获取LinkedList属性项_Java_Linked List_Jcr_Magnolia_Xpathnodeiterator - Fatal编程技术网

Java Magnolia JCR获取LinkedList属性项

Java Magnolia JCR获取LinkedList属性项,java,linked-list,jcr,magnolia,xpathnodeiterator,Java,Linked List,Jcr,Magnolia,Xpathnodeiterator,我正在尝试检索节点0的属性标记值,我相信这是linkedList对象属性。如您所见,它是[**,*****] 我希望检索对象值并存储到列表中对象 因此,我可以获取每个值以备以后使用,例如 String idA = "542f74fd-bfaf-4377-854a-8e62082edc6c"; string idB = "39aab11f-243f-464c-ae6d-c1f069f17d6c"; 我的附件如下: List<String> tagList = new ArrayLi

我正在尝试检索节点0的属性标记值,我相信这是linkedList对象属性。如您所见,它是[**,*****]

我希望检索对象值并存储到
列表中
对象 因此,我可以获取每个值以备以后使用,例如

String idA = "542f74fd-bfaf-4377-854a-8e62082edc6c"; 
string idB = "39aab11f-243f-464c-ae6d-c1f069f17d6c";
我的附件如下:

List<String> tagList = new ArrayList<String>();
tagList = componentNode.getProperties(node, "tags");
List tagList=new ArrayList();
tagList=componentNode.getProperties(节点,“标记”);
我也试过:

List<String> tagList = new ArrayList<String>();
tagList = PropertyUtil.getProperty(node, "tags");
List tagList=new ArrayList();
tagList=PropertyUtil.getProperty(节点,“标记”);
但它们都不起作用

请给我推荐代码示例。
谢谢

我相信它们在JCR中被称为多值属性,并且通过数组而不是列表得到支持

我自己还没有测试过代码,但我相信它会工作的。 这应该可以做到:

  Property property = node.getProperty("tags");     
  Value[] tags = property.getValues();
然后,如果您真的愿意,可以将其转换/包装为列表

希望有帮助


干杯,

我相信它们在JCR中被称为多值属性,并通过数组而不是列表得到支持

我自己还没有测试过代码,但我相信它会工作的。 这应该可以做到:

  Property property = node.getProperty("tags");     
  Value[] tags = property.getValues();
然后,如果您真的愿意,可以将其转换/包装为列表

希望有帮助

干杯,

更好:
List tags=info.magnolia.jcr.util.PropertyUtil.getValuesStringList(node.getProperty(“tags”).getValues())甚至更好:
List tags=info.magnolia.jcr.util.PropertyUtil.getValuesStringList(node.getProperty(“tags”).getValues())